recentpopularlog in

kme : fuckina   159

« earlier  
Quickly Show/Hide Hidden Files on macOS Sierra, OS X El Capitan & Yosemite | Ian Lunn - Front-end Developer
Since the release of macOS Sierra, when in Finder, it is now possible to use the shortcut:

CMD + SHIFT + .


Not sure if this actually (still) works. I'm pretty sure I restarted Finder.
<code class="language-bash">defaults write com.apple.finder AppleShowAllFiles YE</code>
hiddenfiles  dotfiles  mac  osx  macos  finder  hotkey  fuckina  solution 
7 weeks ago by kme
text processing - How to parse hundred html source code files in shell? - Unix & Linux Stack Exchange
Reference: https://www.w3.org/Tools/HTML-XML-utils/
<code class="language-bash">hxselect '#the_div_id' <file</code>

<code class="language-bash">pup '#the_div_id' < file.html</code>
webdevel  cssselectors  commandline  cli  html  parser  fuckina  alternativeto  xmlstarlet 
8 weeks ago by kme
xml - how to? xmlstarlet to extract HTML data by id - Stack Overflow
Essential tip for namespaced HTML, otherwise you get... NOTHING out of 'xmlstarlet'

Just passing HTML through 'xml fo -H -R' (process as HTML and recover as much as possible) is enough to get un-namespaced HTML that is also valid XML (source: https://unix.stackexchange.com/a/382928/278323).

The html data has a default namespace that you have to declare in the xmlstarlet command:
<code class="language-bash">
xmlstarlet sel \
-N n="http://www.w3.org/1999/xhtml" \
-t \
-c "/n:html/n:body/n:table[@id='test_table']/descendant::*/text()" \
htmlfile 2>/dev/null
</code>

UPDATE: I didn't know it but as the error message says, there is no need to declare the namespace when it's the default one, so also this works:
<code class="language-bash">
xmlstarlet sel \
-t \
-c "/_:html/_:body/_:table[@id='test_table']/descendant::*/text()" \
htmlfile 2>/dev/null
</code>
xml  xmlstarlet  textprocessing  malformed  html  reference  namespaced  xhtml  solution  fuckina 
8 weeks ago by kme
Unicode Utilities
This package has an open bug for being removed from Debian because it hard-codes the Unicode 5.1 standard in the binary (we're in the 12s now, so this is probably pre-emoji). Proposed alternative from this bug report (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930315): http://kassiopeia.juls.savba.sk/~garabik/software/unicode/
uniname defaults to printing the character offset of each character, its byte offset, its hex code value, its encoding, the glyph itself, and its name. Command line options allow undesired information to be suppressed and the Unicode range to be added. Other options permit a specified number of bytes or characters to be skipped. For example, the default output for this text:

unidesc reports the character ranges to which different portions of the text belong. It can also be used to identify Unicode encodings (e.g. UTF-16be) flagged by magic numbers. Here is the output when given the above Japanese text as input:

ExplicateUTF8 is intended for debugging or for learning about Unicode. It determines and explains the validity of a sequence of bytes as a UTF8 encoding. Here is the output when given the above Japanese text as input:

Utf8lookup is a shell script which invokes uniname to provide an easy way to look up the character name corresponding to a codepoint from the command line. In addition to uniname it requires the utility Ascii2binary.

Unireverse is a filter that reverses UTF-8 strings character-by-character (as opposed to byte-by-byte). This is useful when dealing with text that is not encoded in the order in which you want to display it or analyze it. For example, if you want to display Arabic on a terminal window that does not support bidi text, Unirev will put it into the normal display order.

Unifuzz generates test input for programs that expect Unicode. It can generate a random string of characters, tokens of various potentially problematic characters and sequences, very long lines, strings with embedded nulls, and ill-formed UTF-8. Use it to find out whether your program reacts gracefully when given unexpected or ill-formed input.
unix  linux  unicode  textprocessing  decode  utility  sourcecode  commandline  fuckina  solution  revealcodes  nonprintingcharacters 
december 2019 by kme
Ubuntu Manpage: uniname - Name the characters in a Unicode text file
From the 'uniutils' package, apparently (via: https://unix.stackexchange.com/a/34278/278323).
uniname names the characters in a Unicode text file. For each character, uniname defaults to printing the character offset, the byte offset, the hexadecimal UTF-32 character code, the encoding as a sequence of hex byte values, the glyph, and the character's Unicode name. Command line flags allow undesired information to be suppressed. Glyphs that do not display nicely, such as control characters and spaces, are not displayed. For the Latin-1 control characters, whose official Unicode name is "control", the real name is given. Character and byte offsets both start from 0.
linux  unicode  decode  textprocessing  fuckina  solution 
december 2019 by kme
mdh34/elementary-indicators: An unofficial guide to restore indicator functionality on elementary OS | https://github.com/
All that seems to be required for most (exception of gtk2) indicators is

- install 'indicator-application' from the repos
- then the old wingpanel-ayatana-indicator package (https://launchpad.net/~elementary-os/+archive/ubuntu/stable/+files/wingpanel-indicator-ayatana_2.0.3+r27+pkg17~ubuntu0.4.1.1_amd64.deb)
- and follow the instructions from https://pinboard.in/u:kme/b:bc95dba3fa3c to customize its XDG .desktop file so it runs in Pantheon

That is:
Edit /etc/xdg/autostart/indicator-application.desktop:
<code class="language-bash">sudo vim /etc/xdg/autostart/indicator-application.desktop</code>
change:
<code class="language-ini">OnlyShowIn=Unity;GNOME;</code>
to
<code class="language-ini">OnlyShowIn=Unity;GNOME;Pantheon;</code>
and 'killall wingpanel'.

Also of note:
If you copy the file to .config/autostart/indicator-application.desktop then you shouldn't have to worry about it getting overwritten again.
elementaryos  wingpanel  panel  indicator  notification  systray  workaround  appindicator  notificationarea  solution  fuckina 
november 2019 by kme
Converting a Bash array into a delimited string - Stack Overflow | https://stackoverflow.com/
So, basically:
<code class="language-bash">a=(one two three)
(IFS='|'; echo "${a[*]}")
# one|two|three
</code>

Also, this was a clever use of some 'man' options I'd never used before.
<code class="language-bash">man -Len -Pcol\ -b bash | sed -ne '/^ *IFS /{N;N;p;q}'</code>

Alternative:
<code class="language-bash">
ids=( 1 2 3 4 )
IFS=\| eval 'lst="${ids[*]}"'
</code>
bash  arrays  manpage  man  tipsandtricks  shellscripting  solution  fuckina 
november 2019 by kme
XTerm introduction and TrueType fonts configuration
My ~/.Xdefaults
<code class="language-xdefaults">! source: http://futurile.net/2016/06/14/xterm-setup-and-truetype-font-configuration/
xterm*background: Black
xterm*faceName: Input Mono
xterm*faceSize: 12
xterm*foreground: grey
! enables "UTF-8 Encoding" and "UTF-8 Fonts" menu options
xterm*locale: UTF-8

xterm*VT100.Translations: #override \
Shift <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)</code>
x11  xterm  configuration  xrdb  xresourcess  howto  macos  osx  xquartz  solution  fuckina  essential  movein 
october 2019 by kme
shell - Unable to locate and replace an element with its classname using bash script? - Stack Overflow
The actual solution is
Clean it up into valid XHTML with tidy

I used
<code class="language-bash">tidy -f /dev/null -w 0 -n -q -asxhtml</code>
in a pipe to suppress all the extraneous warnings, and get XML that something like XMLStarlet could handle.
html  xhtml  xml  tidy  importexport  datamunging  solution  dammitbrain  fuckina 
september 2019 by kme
mutt: how can I open a subfolder that has subfolders? - Stack Overflow
See rdrop.com/docs/mutt/manual67.html: Select the action view-file, which is ba default the <space>-key. The selection key (<enter> by default) will select the subfolder. (I had the same problem and was searching for a while.) – Golar Ramblar Sep 3 '18 at 13:43
mutt  imap  davmail  gmail  keybinding  solution  fuckina 
september 2019 by kme
How to Use Only a Dark Menu Bar and Dock in macOS Mojave
It's not perfect (Notification Center looks like ass, for example), but it's good enough for government work.

<code class="language-bash">defaults write -g NSRequiresAquaSystemAppearance -bool Yes</code>
macos  mojave  darkmode  dock  menubar  customization  solution  fuckina  10.14  movein 
august 2019 by kme
tmux windows and pane split's on current directory (Example)
Apparently this behavior changed in 1.9, but the link to the changelog in this article is broken.

<code>bind-key c new-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"</code>
tmux  movein  config  dotfile  fuckina  solution 
august 2019 by kme
An introduction to bash completion: part 2
I created a script and I use bash_completion, but I cannot figure out how to allow the completion of "--name=value1 --name=value2" (the "=" sign in the middle stop any other completion, and I tried to play with suffixes/prefixes without any success :s


This works:

<code class="language-bash">case "$cur" in
-t*)
cur=${cur/-t}
COMPREPLY=( $(compgen -W "${_tables[*]}" -P "-t" \
-- "$cur" ) )
return 0
;;
--table=*)
cur=${cur/--table=}
COMPREPLY=( $(compgen -W "${_tables[*]}" -P "--table=" \
-- "$cur" ) )
return
;;
*)
COMPREPLY=( $(compgen -W "${_opts[*]}" -- "$cur") )
return
;;
esac</code>
bash  programmablecompletion  tabcompletion  shellscripting  fuckina  solution 
august 2019 by kme
linux - Bash arrays and negative subscripts, yes or no? - Stack Overflow
This is *way* easier than stuff I was trying to do before. The reason this doesn't show up in the help for "Arrays" in the bash manual is because it's a type of "Shell Parameter Expansion" that just happens to behave the way it does when the subscripted thing is an array.
If you just want the last element
<code class="language-bash">$ echo ${muh[*]: -1}
2</code>

If you want next to last element
<code class="language-bash">$ echo ${muh[*]: -2:1}
bleh</code>
bash  shellscripting  arrays  subscripting  syntax  fuckina  solution 
june 2019 by kme
r - Saving and loading history automatically - Stack Overflow
In my ~/.profile I have:
<code class="language-bash">export R_HISTFILE=~/.Rhistory</code>

In my ~/.Rprofile I have:
<code class="language-R">if (interactive()) {
.Last <- function() try(savehistory("~/.Rhistory"))
}</code>

and that works for me (although it doesn't work very well if you have multiple R sessions open). I also have
<code class="language-bash">alias R='R --no-save --no-restore-data --quiet'</code>

in my profile which eliminates the questions on close.
r  repl  history  configfile  annoyance  solution  fuckina 
june 2019 by kme
How do you attach and detach from Docker's process? - Stack Overflow
To detach the tty without exiting the shell, use the escape sequence Ctrl-p Ctrl-q.

more details here: https://docs.docker.com/engine/reference/commandline/attach/

additional info from this source (https://groups.google.com/forum/#!msg/docker-user/nWXAnyLP9-M/kbv-FZpF4rUJ):

* docker run -t -i → can be detached with ^P^Qand reattached with docker attach
* docker run -i → cannot be detached with ^P^Q; will disrupt stdin
* docker run → cannot be detached with ^P^Q; can SIGKILL client; can reattach with docker attach
docker  commandline  tipsandtricks  solution  fuckina 
june 2019 by kme
Bash scripting cheatsheet
Has links to the Bash Hackers wiki, which are helpful.

Has a really good reference for array / associative array syntax, too!
bash  shellscripting  cli  unix  linux  cheatsheet  fuckina 
may 2019 by kme
Ayatana indicator has dissapeared (again) from Juno : elementaryos | https://www.reddit.com/
Ok, I found the solution: it was enough to re-edit /etc/xdg/autostart/indicator-application.desktop:
<code class="language-bash">sudo nano /etc/xdg/autostart/indicator-application.desktop</code>

change again:

<code>OnlyShowIn=Unity;GNOME;</code>

to

<code>OnlyShowIn=Unity;GNOME;Pantheon;</code>

and reboot.


Also:
If you copy the file to .config/autostart/indicator-application.desktop then you shouldn't have to worry about it getting overwritten again.
elementaryos  juno  appindicator  panelindicators  systemtray  systray  fuckina  solution 
may 2019 by kme
Awesome Bar - Search your Firefox bookmarks, history and tabs from the address bar | Firefox Help
Possible workaround for https://superuser.com/q/389136/73744 (Firefox assuming anything with dots in it is a domain name).
If you are looking for a specific type of result, like a bookmark or tag, you can speed up the process of finding it by typing in special characters after each search term in the address bar separated by spaces:

* Add ^ to search for matches in your browsing history.
* Add * to search for matches in your bookmarks.
* Add + to search for matches in pages you've tagged.
* Add % to search for matches in your currently open tabs.
* Add # to search for matches in page titles.
* Add $ to search for matches in web addresses (URLs).
* Add ? to search for matches in suggestions.
firefox  awesomebar  shortcuts  tipsandtricks  reference  fuckina  webbrowser  newbie 
april 2019 by kme
linux - Remove a certain line from Bash history file - Super User | https://superuser.com/
You can achieve removal from the history file using the commandline in two steps:

Typing history -d <line_number> deletes a specified line from the history in memory.
Typing history -w writes the current in-memory history to the ~/.bash_history file.

The two steps together remove the line permanently from the in-memory history and from the .bash_history file as well.
bash  history  security  cya  oops  solution  fuckina 
march 2019 by kme
Windows 7 login scripts and missing network drives | PC LOAD LETTER | https://pcloadletter.co.uk/
This seems to work, creating a scheduled task to run at logon, which runs the batch script that does the 'NET USE's.
windows  sysadmin  networkdrive  drivemapping  loginscript  fuckina  solution 
february 2019 by kme
linux - bash: variable name not being expanded with Tab completion - Super User | https://superuser.com/
shopt -s direxpand will make echo $HOME/<tab> expand to echo /home/matt/ in bash 4.2. In bash 4.1 it should be the default.
bash  tabcompletion  bashcompletion  commandline  shell  configfile  essential  movein  annoyance  solution  fuckina 
february 2019 by kme
dns - Network calls fail during image build on corporate network - Stack Overflow | https://stackoverflow.com/
I was able to figure out the issue. On Ubuntu, Docker sets the DNS servers for container to Google's servers at 8.8.8.x. As I understand it, this is a workaround on Ubuntu due to the fact that Ubuntu sets /etc/resolv.conf to be 127.0.0.1.

Those Google servers weren't accessible from behind our firewall, which is why we couldn't resolve any URLs.

The fix is to tell Docker which DNS servers to use. This fix depends on how you installed Docker:
Ubuntu Package

If you have the Ubuntu package installed, edit /etc/default/docker and add the following line:
<code class="language-bash">
DOCKER_OPTS="--dns <your_dns_server_1> --dns <your_dns_server_2>"
</code>

You can add as many DNS servers as you want to this config. Once you've edited this file you'll want to restart your Docker service:
<code class="language-bash">
sudo service docker restart
</code>
docker  dns  corporatenetwork  bullshit  workaround  fuckina  solution 
february 2019 by kme
DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them | https://support.ssl.com/
Microsofty things use the '.cer' extension (which is interchangeable with '.crt'), and are often DER-encoded. PEM-encoded certs are "ASCII (Base64) armored data" prefixed with a "-----BEGIN CERTIFICATE-----" line.

Here's how to "cat" a DER-encoded certificate:
<code class="language-bash">
openssl x509 -in certificate.der -inform der -text -noout
</code>

And here's how to convert one in that format to the format expected on a Debian GNU/Linux system:
<code class="language-bash">
openssl x509 -in cert.crt -inform der -outform pem -out cert.crt
</code>

NB: the '.crt' extension seems to be important, otherwise 'sudo update-ca-certificates' doesn't pick up on new ones that you've added to /usr/local/share/ca-certificates.
ssl  certs  cacert  certificates  openssl  sysadmin  webmaster  crypto  fuckina  solution  importexport  conversion 
january 2019 by kme
windows 7 - Setting up VirtualBox guest for PXE boot - Super User | https://superuser.com/
Solution: make sure the VM is using bridged networking (to the physical host adapter, 'eno1' or whatever) and install the Oracle secret-sauce Extension Pack.

Older releases here: https://www.virtualbox.org/wiki/Download_Old_Builds_5_1
virtualbox  virtualization  networking  pxe  pxeboot  secretsauce  nonfree  fuckina  solution 
january 2019 by kme
Bash Reference Manual: Command Grouping | https://www.gnu.org/
You have to include a final semicolon to do something like this

<code class="language-bash">
test -f "$1" || { echo "ACK! Can't open '$1'"; return 1; }
</code>
unix  linux  bash  shellscripting  solution  fuckina 
december 2018 by kme
email - Can you use Davmail to access Exchange archives? - Stack Overflow | https://stackoverflow.com/
Solution: https://stackoverflow.com/a/53660862/785213

Best option (suggested here: https://sourceforge.net/p/davmail/support-requests/134/#bf94) is to set the "Public (shared)" path in the server advanced settings to "/archive".

I had to toy with this one a bit; it didn't seem to work on even the first or second try. Things that might have fixed it (?): unchecking "Allow server to override these settings," unchecking "Show only subscribed folder" in server settings, possibly adding a trailing slash at the end of '/archive/'?

IF you create a new account and set the IMAP root to /archive and it mostly works. This might require creating a second account in Thunderbird, and aliasing something like 'localhorst' to 'localhost' in /etc/hosts so that Thunderbird doesn't complain about there being duplicate incoming servers.

Also doesn't seem to work in the 5.3.x series, which doesn't appear to support URLs in the format 'https://server.com/owa', just 'https://server.com/EWS/Exchange.asmx'.
exchange  owa  davmail  thunderbird  email  outlook  onlinearchive  personalarchive  solution  fuckina 
december 2018 by kme
Closed for Business - Matt Gemmell | https://mattgemmell.com/
No-one stops to consider that “choice” is maybe a bad word. Consider that for a moment. What would you like Windows to do with this USB key? Just show me the damned files. Do you want to be warned when you view a web page with mixed secure and insecure content? No, go away. Do you want to pick the font for this text-editing field? No, just use a sensible default. Do you want a lot of after-market crap popping up on the desktop of your new PC? No, I want an experience I’m familiar with.

Nerds like to say that people care about choice at that level. Nerds are wrong. Nerds care about choice, and nerds are such a tiny minority of people that nobody else much cares what the hell they think. Android is designed with far too much nerd philosophy, and open is gravy to those people because it’s synonymous with customisation.

Customisation matters deeply to people who are deeply troubled by what they perceive as minor imperfections or inefficiencies. These same people, as a rule, have a stunning lack of ability to even imagine that others may not share their position. “Pick a sensible default, and skip the Options window” isn’t just anathema; it’s incomprehensible. They need choice.
appstore  walledgarden  business  closedsource  appdevelopment  devel  choice  choices  customization  fuckina 
december 2018 by kme
Xpath cheatsheet | https://devhints.io/
This one is good because it translates between CSS selectors (which you probably already know) to the slightly weirder XPath ones.
essential  xpath  cheatsheet  webdevel  reference  thisone  fuckina 
december 2018 by kme
autocomplete - Disable bash tab completion - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
Dennis' solution
<code class="language-bash">
bind 'set disable-completion on'
</code>

can be done on the fly in Bash as well. You do not need to put it in .bashrc.

Musta's solution (bash --noediting) works but also disables command line editing.

Another way is
<code class="language-bash">
bind -u complete
</code>

(unset key binding associated with 'complete')

http://www.gnu.org/software/bash/manual/bashref.html, 4.2 Bash Builtin Commands.
bash  configsetting  configfile  completion  tabcompletion  itsslow  fuckina  solution 
november 2018 by kme
Thunderbird inserts line breaks in sent HTML that break code lines · Issue #130 · adam-p/markdown-here · GitHub | https://github.com/
Leave the white-space:pre-wrap style in the default CSS. Tell people that the Tbird workaround is to remove that style from their CSS in the MDH options. Someday the Tbird fix will be released.

So just comment out `white-space:pre-wrap` in the settings.
markdownhere  thunderbird  markdown  bug  annoyance  workaround  solution  fuckina 
october 2018 by kme
replace - In Vim is there a way to delete without putting text in the register? - Stack Overflow | https://stackoverflow.com/
To delete something without saving it in a register, you can use the "black hole register":
<code class="language-vim">"_d</code>

Of course you could also use any of the other registers that don't hold anything you are interested in.
vim  security  history  solution  registers  copypaste  fuckina 
october 2018 by kme
sql - Can I concatenate multiple MySQL rows into one field? - Stack Overflow | https://stackoverflow.com/
You can use GROUP_CONCAT:
<code class="language-sql">SELECT person_id, GROUP_CONCAT(hobbies SEPARATOR ', ')
FROM peoples_hobbies GROUP BY person_id</code>
dba  sql  query  mysql  solution  fuckina 
august 2018 by kme
The Man Who Gets His Cars for Free | http://www.mrmoneymustache.com/
The Master sees the Auto for what it really is: A very elaborate and heavy gas-powered wheelchair. There is no shame in using a wheelchair to get around if you need one. But it’s obviously counterproductive to do so when you don’t. So the Master chooses the most efficient model he can find, keeps it in good condition and uses it only when necessary.
So until recently, I thought I was doing pretty well in the auto department because I get plenty of blank stares. Walking my son to the school in the morning, we notice the zoo-like roads from the comfort of our powerful sidewalk. Junior office workers swipe on smartphones while idling in BMW M3s. Teachers on $45,000 salaries show up at school in $42,000 Honda Pilots. Young fathers rip the breathable air to shreds as they spool up the turbos in their jacked up Diesel farm trucks after dropping off a 60-pound child.
2003 Kia Sedona Van – Seller’s rich mother handed down her fancier car. I pointed out how the neighbors in their McMansions didn’t have surplus cars outdoors cluttering their pretty driveways…and flashed some cash. Bought for $1250, sold at cost to a local school.
An Epilogue From MMM:

It turned out that Ben and his wife and I got along so well (plus each family has a single 10-year-old kid), that we decided our families should meet. We booked a vacation rental for next month on an island in South Florida and started working on logistics.

Should we rent a minivan? (Ben emailed me a Craigslist posting entitled “2004 Chevrolet Venture LS – $800” and said we could drive it for a week then sell it at a profit. Minutes later another one arrived for a big old Chrysler Sebring convertible for a similar price.)

How much is the water taxi to get out to the island? (Posting for a 6-person paddle boat for $80 on Fort Myers Craigslist)

Where can we get food? Fun? Bikes? All questions readily answered with just a few seconds of research.

You adopt this philosophy very casually or dive right in as Ben has done. The point is that resourcefulness and not following the standard consumer script pays great dividends, in both money and fun.
automobiles  transportation  perspective  fuckina 
august 2018 by kme
webdav - How do I enable HTTP-DAV in Apache? - Server Fault | https://serverfault.com/
Yup, I made this mistake, too:
I finally figured it out.

Instead of
<code class="language-apache"><Location /var/www/html/updates>
Dav On
</Location></code>

it needs to be (Directory instead of Location)
<code class="language-apache"><Directory /var/www/html/updates>
Dav On
</Directory></code>
apache  webmaster  configfile  webdav  solution  fuckina 
august 2018 by kme
How to Create a List of Your Installed Programs on Windows
Astonished that this is the first useful use case I've found for PowerShell so far.

<code style="language-powershell">Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize</code>
sysadmin  win7  powershell  installation  maintenance  reporting  commandline  cli  fuckina  solution 
july 2018 by kme
image manipulation - Create drop shadow effects in Imagemagick - Stack Overflow
<code class="language-bash">convert input.jpeg -bordercolor white -border 13 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage output.jpg
</code>

As a gist: https://gist.github.com/ernstki/742a2140047e74804572d7e3e95a80d4
imagemagick  dropshadow  imageprocessing  solution  commandline  scripting  fuckina 
july 2018 by kme
Add Shadow and Border to Images with ImageMagick | bemoko's blog on mobile
<code class="language-bash">image-shadow () {
out=${1%.*}-shadow.${1#*.}
in=$1
echo "Converted file : $out"
if [ ! -z $2 ] ; then
convert $in -frame $2 $out
in=$out
fi
convert $in \( +clone -background black -shadow 60x5+10+10 \) \
+swap -background white -layers merge +repage $out
}</code>
magemagick  imageprocessing  dropshadow  imagemanipulation  scripting  solution  fuckina 
july 2018 by kme
GitLab.com settings | GitLab | https://docs.gitlab.com/
<code>
DSA 7a:47:81:3a:ee:89:89:64:33:ca:44:52:3d:30:d4:87 p8vZBUOR0XQz6sYiaWSMLmh0t9i8srqYKool/Xfdfqw
ECDSA f1:d0:fb:46:73:7a:70:92:5a:ab:5d:ef:43:e2:1c:35 HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw
ED25519 2e:65:6a:c8:cf:bf:b2:8b:9a:bd:6d:9f:11:5c:12:16 eUXGGm1YGsMAS7vkcx6JOJdOGHPem5gQp4taiCfCLB8
RSA b6:03:0e:39:97:9e:d0:e7:24:ce:a3:77:3e:01:42:09 ROQFvPThGrW4RuWLoL9tq9I9zJ42fK4XywyRtbOz/EQ
</code>
gitlab  ssh  fingerprint  hostkeyfingerprints  reference  fuckina  solution 
may 2018 by kme
Extension:PlaceNewSection - MediaWiki | https://www.mediawiki.org/
You need to add __ADDNEWSECTIONBELOW__ and __NEWSECTIONLINK__ to your article (if it's outside the "Talk" namespace) in order to get this working. But it works!

Other useful references:

* https://phabricator.wikimedia.org/T122884 - (Make it possible to) always ignore NEWSECTIONLINK in mainspace at the English Wikipedia
* https://www.mediawiki.org/wiki/Help:Magic_words
* https://en.wikipedia.org/wiki/MediaWiki:Gadget-addsection-plus[.js]
* https://en.wikipedia.org/wiki/MediaWiki:Gadgets-definition
mediawiki  editing  extension  movein  essential  fuckina  solution 
may 2018 by kme
Wirble: Tab-Completion and Syntax Coloring for irb | http://www.rubyinside.com/
If you haven't got tab-completion and syntax coloring in your irb, you owe it to yourself to follow these instructions right away (should work for Linux, OS X, and Cygwin users). First, install the Wirble gem:
<code class="language-bash">sudo gem install -y wirble</code>

Next, create or edit a file called .irbrc in your home folder (~/.irbrc), and make sure these lines are included there:
<code class="language-ruby">require 'rubygems'
require 'wirble'
Wirble.init
Wirble.colorize</code>
ruby  repl  irb  syntaxhighlighting  fuckina  solution 
may 2018 by kme
astanin / python-tabulate / issues / #135 - Row length — Bitbucket
<code class="language-python">>>> table_multiline = [[textwrap.fill(row[0], width=12)]+row[1:] for row in table]</code>
python  textwrapping  textprocessing  newlines  whitespace  fuckina  solution 
march 2018 by kme
View the character unicode values of a word document - Stack Overflow | https://stackoverflow.com/
In Word, select the character and press "alt-x"

In Vim, the same function is 'g8' (try also 'ga' if decimal or octal are representations interesting).
unicode  revealcodes  word  libreoffice  openoffice  solution  fuckina 
january 2018 by kme
security - What is the difference between a cer, pvk, and pfx file? - Stack Overflow | https://stackoverflow.com/
Windows .cer files are ASN.1 DER encoded (you can decoded these with 'dumpasn1' on Linux or use http://www.lapo.it/asn1js/ for a web version--don't upload private keys there, though).

You can also decode with OpenSSL:

<code class="language-bash">
openssl asn1parse -inform der -in SomeIssuer.cer

# or, given a .cer file from Windows, something like this works:
openssl x509 -inform der -in SomeIssuer.cer -fingerprint -sha1
</code>

This was a helpful guide for decoding the various file extensions:

<code>Here are my personal, super-condensed notes, as far as this subject pertains to me currently, for anyone who's interested:

Both PKCS12 and PEM can store entire cert chains: public keys, private keys, and root (CA) certs.
.pfx == .p12 == "PKCS12"
fully encrypted
.pem == .cer == .cert == "PEM"
base-64 (string) encoded X509 cert (binary) with a header and footer
base-64 is basically just a string of "A-Za-z0-9+/" used to represent 0-63, 6 bits of binary at a time, in sequence, sometimes with 1 or 2 "=" characters at the very end when there are leftovers ("=" being "filler/junk/ignore/throw away" characters)
the header and footer is something like "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" or "-----BEGIN ENCRYPTED PRIVATE KEY-----" and "-----END ENCRYPTED PRIVATE KEY-----"
Windows recognizes .cer and .cert as cert files
.jks == "Java Key Store"
just a Java-specific file format which the API uses
.p12 and .pfx files can also be used with the JKS API
"Trust Stores" contain public, trusted, root (CA) certs, whereas "Identity/Key Stores" contain private, identity certs; file-wise, however, they are the same.</code>
ca  certificate  x509  webmaster  webdevel  fileextension  fuckina  solution 
january 2018 by kme
Man pages docset? · Issue #115 · zealdocs/zeal
These do not look great, and they're just the POSIX manpages, so they'll be different from the ones actually installed on your system (e.g., missing GNU Findutils and so forth). Needs help.

1. Download Linux.docset.zip from here https://github.com/Yanpas/mandocset/tree/master/etc
2. Extract it to Linux.docset folder
3. Move this folder to Zeal docsets (C:\Users\%username%\AppData\Local\Zeal\Zeal\docsets or ~/.local/share/Zeal/Zeal/docsets/
zeal  manpages  documentation  solution  linux  devel  fuckina  needshelp 
december 2017 by kme
bash - Multi-line, double quoted string triggers history expansion on subsequent single-quoted commands it gets piped to - Stack Overflow | https://stackoverflow.com/
Makes more sense now why things like `echo "Hi there!"` don't work, but `echo "Hi there! "` do.
It is not a bug.

After asking this in the bash-bugs mailing list, I got the following answer:
History expansion is explicitly line-oriented.

It doesn't know about shell state, especially shell quoting state, that spans lines.

It does know about vaguely shell-like quoting that's common across a large set of Unix utilities -- since the history and readline libraries are used outside the shell -- and that a double quote introduces a quoted string in which single quotes are not significant and don't inhibit history expansion.
Upvote for documenting this, but that's insane behavior. – tripleee Jun 20 '16 at 8:42
bash  quoting  historyexpansion  history  weirdness  annoyance  gotcha  solution  fuckina 
november 2017 by kme
How can I replace a newline (n) using sed? - Stack Overflow | https://stackoverflow.com/
Note that you have to give each command as a separate `-e` in OS X and BSD. I thought that the `$!ba` was the problem (history expansion), and wasted a bunch of time trying to figure out why it wouldn't work on OS X. It was the semicolons!
Fast answer:

<code class="language-bash">sed ':a;N;$!ba;s/\n/ /g' file</code>

- :a create a label 'a'
- N append the next line to the pattern space
- $! if not the last line, ba branch (go to) label 'a'
- s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can)

sed will loop through step 1 to 3 until it reach the last line, getting all lines fit in the pattern space where sed will substitute all \n characters

All alternatives, unlike sed will not need to reach the last line to begin the process

with bash, slow

<code class="language-"bash>while read line; do printf "%s" "$line "; done < file</code>

with perl, sed-like speed

<code class="language-bash">perl -p -e 's/\n/ /' file</code>

with tr, faster than sed, can replace by one character only

<code class="language-bash">tr '\n' ' ' < file</code>

with paste, tr-like speed, can replace by one character only

<code class="language-bash">paste -s -d ' ' file</code>

with awk, tr-like speed

<code class="language-bash">awk 1 ORS=' ' file</code>
bash  shellscript  sed  syntax  newbie  textprocessing  fuckina  solution 
november 2017 by kme
Get the name of the current file | Vim Tips Wiki | FANDOM powered by Wikia | http://vim.wikia.com/
<code class="language-vim">" given: /abc/def/my.txt
:echo expand('%:p:h:t') " ==> def
" First get the full path with :p (/abc/def/my.txt),
" then get the head of that with :h (/abc/def),
" then get the tail of that with :t (def)</code>
vim  dammitbrain  filemanagement  variables  syntax  fuckina  solution 
november 2017 by kme
GitHub - peterldowns/iterm2-finder-tools: Open iTerm2 from the Finder | https://github.com/
You need to change the (bundled) Automator app to open a new window rather than a tab, if that's what you want by default.

As of 2019-09-05, I had to remove the "try" block and leave behind just the 'set newWindow to (create window with default profile)' so it wasn't trying to open a tab (invisbly) using the drop-down hotkey window.
iterm  finder  automation  hotkey  applescript  filemanagement  fuckina  solution 
november 2017 by kme
VIM Quick Reference Card | http://tnerual.eriogerg.free.fr/
This one has a concise summary of search/replace, which is what I needed.
vim  quickref  cheatsheat  reference  solution  fuckina 
november 2017 by kme
perl - Force CPAN to download via HTTP - Server Fault | https://serverfault.com/
Try these:

Before running cpan: export -n http_proxy
In the cpan shell: o conf http_proxy ''
To save your modified cpan config: o conf commit

That will disable any http proxy CPAN is configured to use.
perl  cpan  http  proxy  annoyance  fuckina  solution 
october 2017 by kme
printing - Why does the column command not align columns properly? - Unix & Linux Stack Exchange - https://unix.stackexchange.com/
tldr; use 'column -t'

See also: https://stackoverflow.com/q/35199453
To align the LSH of each successive field to the one above it, you need to use the -t option, eg. column -t ztxt

aaa1 aaaaaaaaaaaaaa2 aaaaaaaaaaaaaaaaaaa3 aaa4
bbbbbb1 bbb2 bbb3
ccc1 ccc2
textprocessing  unix  shellscripting  prettyprinting  solution  fuckina 
october 2017 by kme
XML::Twig - A perl module for processing huge XML documents in tree mode. - metacpan.org - https://metacpan.org/
So 'xml_grep --text_only --html' options seems work a treat; these come with the 'xml-twig-tools' package on Debian/Ubuntu.

Quick start:

<code class="language-bash">
> xml_grep -html -t 'a[@class="genu"]' http://stackoverflow.com
> Stack Exchange
</code>

Another useful example, I used when making a GeSHi syntax for ~/.ssh/config:

<code class="language-bash">
curl https://man.openbsd.org/ssh_config | \
xml_grep --html --text_only 'dt[@class="It-tag"]/*/b'
</code>

No matter what I do, I can't get the 'text()' XPath selector to work, even though it's part of the XPath 1.0 standard. That's why '-t' or '--text_only' seems to be necessary, to return the text content of the matched nodes.

The '--html' is also pretty essential, because I think it runs the input through a more liberal HTML parser, produces a valid (X)HTML tree, and then you don't get XML parse errors like do you for just about every page on the Internet, it seems like.

On that note, now I finally see the value of "conformant" XHTML, and I'm wondering: why did XHTML cease to be a thing?

Example:
<code>curl -q https://packages.debian.org/wheezy/keepassx | xml_grep --text_only --html '//*[@id="pdeps"]/ul/li//a'</code>
xpath  xslt  xml  parser  parsing  perl  module  library  commandline  cli  solution  fuckina 
october 2017 by kme
BashFAQ/053 - Greg's Wiki | http://mywiki.wooledge.org/
I have a fancy prompt with colors, and now bash doesn't seem to know how wide my terminal is. Lines wrap around incorrectly.
You must put \[ and \] around any non-printing escape sequences in your prompt. Thus:
<code class="language-bash">fancy_prompt() {
local blue=$(tput setaf 4)
local purple=$(tput setaf 5)
local reset=$(tput sgr0)
PS1="\[$blue\]\h:\[$purple\]\w\[$reset\]\\$ "
}</code>

Without the \[ \], bash will think the bytes which constitute the escape sequences for the color codes will actually take up space on the screen, so bash won't be able to know where the cursor actually is.
bash  ps1  promptstring  colors  fuckina 
september 2017 by kme
Use groff to easily create PDF pages - Mac OS X Hints | http://hints.macworld.com/
Can I make groff produce PS output with monospaced fonts?

Update (20171218): Yup. Use the "C" (Courier) font, like this:

<code class="language-bash">
# fonts are in /usr/share/groff/<ver>/font/devps
# don't put 'R' ("regular" I guess) or 'B' or 'I' on the end, just "C"
# the files can be viewed with 'less' to discern what their "proper" name is
groff -mandoc -f C -Tps $(man -w manpage) > manpage.ps
</code>

(Careful, '-l' sends it straight to the printer.)

From the comments:
As someone who has been using *roff since about 1976 (first roff, under V6 UNIX, then nroff/troff, then ditroff, then MKS/SoftQuad sqroff, then groff under BSDI and FreeBSD and now under MacOS/X), it warms my heart to see that the program continues to live on and have value.

One of the most useful features in the *roff family is the set of filters that exist for it. These are aimed at tables (tbl), equations (eqn), figures (pic), graphs (grap), and references (refer). There are also macro packages that may have value to some other than -mom and -man, such as -ms, which is probably the oldest, widely-used package, and -me, which was designed for typesetting dissertations. Finally, for those who are inclined towards programming, it can be very useful to use make(1) to manage all the pieces, filtering, and transformations in a longer groff document.

There are weaknesses with *roff in today's environment, chiefly the fact that it doesn't directly support output formats that are currently portable, such as .rtf and .pdf (you can get to .pdf from .ps as in the hint and also in various other ways, but the current .rtf translators are unacceptable). The problem is that some journals require either .doc or .rtf for manuscripts. However, there are other output formats that are supported, see groff(1).
groff  typesetting  unix  manual  manpages  mac  osx  tipsandtricks  solution  fuckina 
september 2017 by kme
Find a macports package given a file name - Stack Overflow | https://stackoverflow.com/
Unfortunately MacPorts currently (2.3.1) only supports that if you have the port installed, i.e. if you want to find out which port installed a file on your system. In this case, you can use port provides <filename>.

If you are looking for a port to install using an executable name, you're out of luck – MacPorts doesn't have the required databases to do that.

What I usually do instead is search for the file in a Linux distribution, e.g. using apt-file search <filename> on Debian. Given the Debian package name, I search for a similar MacPorts port.
mac  osx  macports  fuckina  packagemanagement  sysadmin  dammitbrain  solution 
september 2017 by kme
flask_admin.base — flask-admin 1.5.0 documentation
I think this took me like 3 months to figure out. It's not in a great spot in the docs.
flask-admin  flask  webdevel  annoyance  fuckina  solution 
august 2017 by kme
entr(1) [http://entrproject.org/]
Yup, this does what I want, for the most part.

Redirection is a problem, because it doesn't shell out, it really just executes the first argument you give it as a problem. But 'bash -c "some long command line"' works, as does '-s "pipe | line"' for pipelines.

Also, this is badass:
<code class="language-bash">$ ls *.css *.html | entr reload-browser Firefox</code>
filesystem  inotify  cli  automation  utility  sysadmin  commandline  essential  solution  webdevel  livereload  fuckina 
august 2017 by kme
regex - How do I grep for all non-ASCII characters in UNIX - Stack Overflow
You can use the command:

grep --color='auto' -P -n "[\x80-\xFF]" file.xml

This will give you the line number, and will highlight non-ascii chars in red.
unix  ascii  utf  datamunging  textprocessing  fuckina  dammitbrain  solution 
june 2017 by kme
« earlier      
per page:    204080120160

Copy this bookmark:





to read