Skip to content

Instantly share code, notes, and snippets.

Sarah Mount snim2

Block or report user

Report or block snim2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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 / clock_res.c
Created Apr 2, 2014
Print available (Linux) system clock resolutions
View clock_res.c
/* 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 / issue-tags.txt
Created Apr 16, 2014
Example tags from an issues list on Google Code
View issue-tags.txt
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 / time-example.bash
Created May 13, 2014
Example of the time command
View time-example.bash
$ 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
View 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
View a.github.sh
#!/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">//'`
View HOWTO.md

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"
View gist:4af7b12076a31b13190c
$ export PYTHONPATH=$PYTHONPATH:/opt/pypy:. ; py.test -v tests/compiler/_*.py -k test_ast_functionstatement -s
======================================================== test session starts =========================================================
platform linux2 -- Python 2.7.6 -- pytest-2.2.4.dev2 -- /usr/bin/python
collecting 0 items[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-default-16/platcheck_0.c -o /tmp/usession-default-16/platcheck_0.o
[platform:execute] gcc /tmp/usession-default-16/platcheck_0.o -pthread -lintl -lrt -o /tmp/usession-default-16/platcheck_0
collecting 23 items/home/snim2/Desktop/working/snim2/naulang/naulang/compiler/parser.py:317: ParserGeneratorWarning: 48 shift/reduce conflicts
PARSER = pg.build()
collected 110 items
tests/compiler/test_ast.py:137: test_ast_functionstatement PASSED
@snim2
snim2 / tocloft_example
Last active Aug 29, 2015
An example use of tocloft and IEEE format
View tocloft_example
%
% http://tex.stackexchange.com/questions/197369/how-to-use-tocloft-to-create-a-list-which-appears-in-the-middle-of-the-document
%
% http://tex.stackexchange.com/questions/198326/tocloft-cross-references-a-section-as-a-subsection
%
\documentclass[conference]{IEEEtran}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage[titles]{tocloft}
@snim2
snim2 / keywords.tex
Created Aug 25, 2014
Example LaTeX listings with mixed alphanumeric keywords
View keywords.tex
\documentclass[12pt]{article}
\usepackage{xcolor}
\usepackage{listings}
\renewcommand{\ttdefault}{pcr}
\definecolor{Black}{gray}{0.0}
\definecolor{Blue}{rgb}{0.12,0.29,0.53}
You can’t perform that action at this time.