Skip to content

Instantly share code, notes, and snippets.

#!/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 / time-example.bash
Created May 13, 2014 12:44
Example of the time command
$ echo "must say /usr/bin/time in full here as BASH reimplements the command"
must say /usr/bin/time in full here as BASH reimplements the command
$ /usr/bin/time -v wc mpi-gmp.quadrature.c.html
163 1028 19555 mpi-gmp.quadrature.c.html
Command being timed: "wc mpi-gmp.quadrature.c.html"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.02
Average shared text size (kbytes): 0
@snim2
snim2 / issue-tags.txt
Created April 16, 2014 22:27
Example tags from an issues list on Google Code
Efdhack-2012 = Suitable Issue for a 2012 hackday
Estimate-Hours = A developer estimates that this issue will take a few hours (or less) to resolve
Estimate-Days = A developer estimates that this issue will take a few days (or less) to resolve
Estimate-Weeks = A developer estimates that this issue will take a few weeks (or less) to resolve
Estimate-Months = A developer estimates that this issue will take a few months (or less) to resolve
Type-Defect = Report of a software defect
Type-Enhancement = Request for enhancement
Type-Task = Work item that doesn't change the code or docs
Type-Review = Request for a source code review
Type-Other = Some other kind of issue
@snim2
snim2 / clock_res.c
Created April 2, 2014 14:45
Print available (Linux) system clock resolutions
/* Print a table of available timer frequencies. Linux only.
*
* (c) Sarah Mount <s.mount@wlv.ac.uk> 2014.
*/
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
#include <time.h>
@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 / .travis.yml
Last active August 31, 2023 20:03
Travis-CI recipe for testing LaTeX projects compiled by a Makefile
install:
- sudo apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- sudo apt-get install chktex
script:
- make
- chktex -W # Print version information.
- chktex -q -n 6 *.tex chapters.*.tex 2>/dev/null | tee lint.out
# If lint output is non-empty report an error.
- test ! -s lint.out
@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 / pre-commit.py
Created September 5, 2013 00:50
A git pre-commit hook to test Python code for PEP8 compliance, and run unit tests via the pytest framework
#!/usr/bin/env python
"""
Git pre-commit hook to enforce PEP8 rules and run unit tests.
Copyright (C) Sarah Mount, 2013.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
@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 )