Skip to content

Instantly share code, notes, and snippets.

View rm--'s full-sized avatar

René rm--

View GitHub Profile
merged_branches(){
local red=`tput setaf 1`
local green=`tput setaf 2`
local bold=`tput bold`
local reset=`tput sgr0`
local current_branch=$(git rev-parse --abbrev-ref HEAD)
for branch in $(git branch --merged | cut -c3-)
do
if [[ $branch = $current_branch ]]; then
@rm--
rm-- / git_rm_local_and_remote_branches.md
Last active November 5, 2015 21:47
remove local and remote branches
@rm--
rm-- / rename files.py
Created November 21, 2015 11:17
list comprehension to bulk rename files
pip install natsort
import os
src_dir = '/tmp/in'
dst_dir = '/tmp/out'
starting_nb = 11 # new filename starting with this number
[os.rename(src_dir + os.sep + f,dst_dir + os.sep + str(i) + '.' + f.split('.')[1]) for (i,f) in enumerate(natsort.natsorted(os.listdir(src_dir)),starting_nb)]
@rm--
rm-- / man2pdf.md
Last active November 28, 2015 14:59
covert man page (eg. bash) to pdf
  man -T bash bash | ps2pdf - bash.pdf

first bash is the page you are looking for

@rm--
rm-- / linter-hlint.md
Last active November 29, 2015 09:45
atom linter-hlint package

global installation of:

cabal install happy
cabal install ghc-mod
apm install linter
apm install language-haskell
@rm--
rm-- / remove_all_py_pkges.md
Created February 23, 2016 15:23
remove all installed python packages
pip freeze | grep -v "^-e" | xargs pip uninstall -y

@rm--
rm-- / browser_notes.md
Created March 16, 2016 12:30
use your browser for notes

type into address bar:

data:text/html, <html contenteditable>
@rm--
rm-- / keybase_proof
Created March 16, 2016 20:53
keybase proof
### Keybase proof
I hereby claim:
* I am rm-- on github.
* I am rmuhl (https://keybase.io/rmuhl) on keybase.
* I have a public key ASC7fqdefiSnMMiYUt-_DFHRnoSbL7q688IBNmS-fMxJmgo
To claim this, I am signing this object:
@rm--
rm-- / maxs_serve_file_content.py
Created March 20, 2016 21:08
py script to serve text from file and reload automatically (written by Max)
import time
import BaseHTTPServer
HOST_NAME = '127.0.0.1'
PORT_NUMBER = 8080
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(s):
@rm--
rm-- / yesod_debug.hs
Last active June 8, 2016 20:47
haskell/yesod log debug
-- pure code
import Debug.Trace
trace ("your text " ++ show value) value
-- monadic code
import Control.Monad.Logger
import Data.Text
logWarnN $ "your debug text " <> pack (show value)