Skip to content

Instantly share code, notes, and snippets.

@techraf
techraf / gist:c882481ab10ae96ae749
Last active August 29, 2015 14:04
prefix (prepend) contents of clipboard to a file
# bash function (Mac OSX)
# prefix clipboard to a file with contents of clipboard
# based on comments under http://www.cyberciti.biz/faq/bash-prepend-text-lines-to-file/
# uses diff and patch to retain destination file attributes
prepend () { diff -u <(head "$@") <(echo -e "`pbpaste`\n`head "$@"`") >/tmp/mypatch; patch "$@" </tmp/mypatch ; }
@techraf
techraf / myip.sh
Last active August 29, 2015 14:04
myip (show my public IP)
#!/bin/bash
#
# myip.sh
# returns public IP
# retrieving from HTTP service
ipcheckerurl="http://checkip.amazonaws.com/"
myip=`curl --silent ${ipcheckerurl}`
# retrieving with 'dig' command
@techraf
techraf / todo.txt-rand
Last active August 29, 2015 14:04
get one random task from todo.txt
#!/bin/bash
#
# .todo.actions.d/rand
# extension for https://github.com/ginatrapani/todo.txt-cli
# display one random task from todo.txt matching filter
if [ -n "$1" ]; then
if [ "$1" == "usage" ]; then
echo " $(basename $0)"
echo " Displays one random task."
@techraf
techraf / imagemagick
Last active August 29, 2015 14:04
coverting images with imagemagick
coverting images with imagemagick
@techraf
techraf / shadow-off.sh
Created July 28, 2014 11:46
Mac OSX screenshots - shadow on / off
#!/bin/bash
#
# source
# http://osxdaily.com/2011/05/23/disable-shadow-screen-shots-mac/
#
defaults write com.apple.screencapture disable-shadow -bool true
killall SystemUIServer
@techraf
techraf / link-to-cli.sh
Created July 28, 2014 11:47
TextMate create symlink
###################
# handy aliases #
###################
alias ls='ls -FG' # -F add trailing / @ * -G color
alias l='ls'
alias ll='ls -al'
alias lh='ls -ahl'
alias h='history'
alias j='jobs -l'
alias c='clear'
#####################
# locale settings #
#####################
export LANG=en_US.utf-8
export LESSCHARSET=utf-8 # basically LESSCHARSET seems not necessary when ".utf-8" is set in LANG
Windows iso files (mount, create)