Skip to content

Instantly share code, notes, and snippets.

Creating the post-commit file

Note: If you want to use your personal Twitter account to post commits, go to Step 2

  1. Create a new Twitter account for your commit messages. Example
  2. Go to http://dev.twitter.com and Sign In with your Twitter account you are posting commit messages to.
  3. Hover over your username in the top-right corner after signing in and select "My Applications"
  4. Create a new application
  5. The name, description, and site can all be whatever you want, but leave Callback URL empty
  6. Under "Application Settings" click "modify app permissions" next to "Access level"
#!/bin/bash
# Usage Example: $ clone-github github_id
# would clone all the git repositories managed under github_id at current path
# save it as /etc/profiles/a.github.sh
##
clone-github(){
GITHUB_ID=$1
GITHUB_REPO_URI="https://github.com/"$GITHUB_ID"?tab=repositories"
repos=`curl -skL $GITHUB_REPO_URI | grep 'title="Forks"' | sed "s/.*$GITHUB_ID\///" | sed 's/\/network"\stitle="Forks">//'`
@snim2
snim2 / pdfstill
Created June 10, 2014 16:27 — forked from sampsyo/pdfstill
#!/bin/sh
infn=$1
outfn=`basename $infn .pdf`.still.pdf
# Embed fonts.
gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outfn \
-dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -c .setpdfwrite -f $infn
# Strip metadata crap added by Ghostscript.
exiftool -Title="" $outfn
@snim2
snim2 / pro_tip.md
Created March 15, 2014 23:42 — forked from zph/pro_tip.md

Want to push to two Git Repos via a single command?

Want to do it easily via a simple .git edit?

My use case is pushing code that resides on Github as well as on Bitbucket. I want it available in both remote locations in case one is unavailable.

Here's how you do it:

Add the two remotes as normal

@snim2
snim2 / gist:8639969
Created January 26, 2014 21:57 — forked from haard/gist:8639666
branch_mapping = [('default', 'master')]
target = "git+ssh://git@github.com/haard/test"
repo = hgapi.Repo(path)
for hgb, gb in branch_mapping:
repo.hg_command('bookmark', '-r', hgb, gb)
repo.hg_command("--config", "paths.default=" + target, "--config", "extensions.hggit=", "push")
@snim2
snim2 / editor.sh
Created April 2, 2013 00:32 — forked from ttscoff/editor.sh
#!/bin/bash
case "$1" in
*_EDITMSG|*MERGE_MSG|*_TAGMSG )
/usr/local/bin/vim "$1"
;;
*.md )
/usr/local/bin/mmdc "$1"
;;
*.txt )
@snim2
snim2 / Python Notepad Bookmarklet
Last active December 11, 2015 23:18 — forked from jakeonrails/Ruby Notepad Bookmarklet
Stick this in the URL bar of a browser to open up an in-browser syntax highlighted text editor
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/Cobalt");e.getSession().setMode("ace/mode/python");</script>