Skip to content

Instantly share code, notes, and snippets.

@wh13371
wh13371 / find.sh
Created July 6, 2015 15:38
linux - find files less than x chars
find . -not -name '?????*'
@wh13371
wh13371 / cat.sh
Created July 6, 2015 15:37
linux - cat
cat -v moo.sh
cat moo.sh | hexdump -c
cat moo.sh | hexdump -C
@wh13371
wh13371 / nano.sh
Created July 6, 2015 15:34
gist - bash date with nano-second
date +%s.%N
@wh13371
wh13371 / dos2unix.txt
Created July 6, 2015 15:32
OSX - dos2unix
tr -d '\r' < print.sh > moo.sh
@wh13371
wh13371 / epoch.sh
Created July 6, 2015 15:31
bash - epoch
#!/bin/bash
epoch=$(date +%s)
t=$(date +%Y_%m_%d_%H_%M_%S)
sleep 0.1
echo $epoch
@wh13371
wh13371 / move_files.sh
Created June 9, 2015 07:46
linux - move files
FOLDER_YESTERDAY=`date +%Y%m%d --date=yesterday`
FOLDER_TODAY=`date +%Y%m%d`
mkdir -p "${FOLDER_TODAY}"
mv "${FOLDER_YESTERDAY}"/*.log "${FOLDER_TODAY}/"
@wh13371
wh13371 / bin_folder.txt
Created April 6, 2015 09:33
use "$home\Copy\bin" as me "bin" folder - via ".bash_profile" that way it's backed up
# User specific environment and startup programs
# original
#PATH=$PATH:$HOME/bin
# via Copy - so its backed up
PATH=$PATH:$HOME/Copy/bin
export PATH
# create a folder, for hacking, if !exist
mkdir -p tmp
@wh13371
wh13371 / clip.py
Created April 4, 2015 14:45
linux = python clip
#! /usr/bin/python
from gtk import Clipboard
import sys
def clip_in(text):
cb = Clipboard()
cb.set_text(text)
cb.store()
@wh13371
wh13371 / .bash_profile
Last active August 29, 2015 14:15
.bash_profile - mac
# myMAC .bash_profile
# a decent bash prompt
# \d = date - \t = time - \u = user - \h = host - \w = cwd
#PS1='\[\e[1;33m\]\d \[\e[1;34m\]\t \[\e[1;36m\]\u\[\e[1;35m\]@\[\e[1;31m\]\h \[\e[1;33m\](\[\e[1;36m\]\w\[\e[1;33m\]) \[\e[1;37m\]% \e[m'
PS1='\[\e[1;35m\][\[\e[1;33m\]\d \[\e[1;34m\]\t \[\e[1;35m\]\u\[\e[1;36m\]@\[\e[1;31m\]\h\[\e[1;33m\](\[\e[1;36m\]\w\[\e[1;33m\])\[\e[1;35m\]]\[\e[1;37m\]% \e[m'
alias docs='cd ~/Documents'
alias h=history
alias mx="chmod a+x"