Skip to content

Instantly share code, notes, and snippets.

# Total Commits per author
git shortlog -sn
# Author total addition and substraction
git log --numstat --pretty="%H" --author="Sinister Light" | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
# Number of lines per author
git ls-files | xargs -n1 -d'\n' -i git blame {} | perl -n -e '/\s\((.*?)\s[0-9]{4}/ && print "$1\n"' | sort -f | uniq -c -w3 | sort -r
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
class S(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
@SinisterLight
SinisterLight / Links
Last active August 29, 2015 14:00
Links
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
rm -r /opt/torquebox/torquebox/jboss/standalone/data/messagingjournal/*.hq
rm -r /opt/torquebox/torquebox/jboss/standalone/data/messagingbindings/*.jms
rm -r /opt/torquebox/torquebox/jboss/standalone/data/messagingbindings/*.bindings
java -cp /opt/torquebox/torquebox/jboss/modules/org/hornetq/main/hornetq-core-2.2.21.Final.jar:/opt/torquebox/torquebox/jboss/modules/org/jboss/netty/main/netty-3.2.6.Final.jar org.hornetq.core.journal.impl.ImportJournal /opt/torquebox/torquebox/jboss/standalone/data/messagingbindings/ hornetq-bindings bindings 1048576 message_binding
java -cp /opt/torquebox/torquebox/jboss/modules/org/hornetq/main/hornetq-core-2.2.21.Final.jar:/opt/torquebox/torquebox/jboss/modules/org/jboss/netty/main/netty-3.2.6.Final.jar org.hornetq.core.journal.impl.ImportJournal /opt/torquebox/torquebox/jboss/standalone/data/messagingbindings/ hornetq-jms jms 1048576 message_jms
java -cp /opt/torquebox/torquebox/jboss/modules/org/hornetq/main/hornetq-core-2.2.21.Final.jar:/opt/torquebox/torquebox/jboss/mod
yum install openssl-devel
yum install gcc-c++
cd /usr/local/src
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxvf node-latest.tar.gz
cd node-v0.10.5
./configure
make
make install
@SinisterLight
SinisterLight / gist:5655901
Last active December 17, 2015 18:49
Install rbenv | moving from rvm to rbenv
rvm implode
brew update
brew install rbenv
brew install ruby-build
rbenv init -
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
rbenv install 1.9.3-p429
rbenv rehash
@SinisterLight
SinisterLight / JS Patterns
Created May 30, 2013 12:56
Standard JS helpers
function asyncForEach(array, iterator, then) {
function loop(i) {
if (i < array.length) {
iterator(array[i], function() {
loop(i + 1);
}
else {
then();
}
}
function success(position) {
}
function error() {
}
if (navigator.geolocation) navigator.geolocation.getCurrentPosition(success, error);
else error();
@SinisterLight
SinisterLight / re.clj
Created April 15, 2017 14:08 — forked from clojens/re.clj
A few clojure java regex samples
(def ptrn
{
:a {:pattern #"a(?!b)"
:purpose "Only allow a if it is not preceded by a 'b' (negative lookahead)"
:samples ["acdefg" ; ok
"abcdef" ; nil
]}
:b {:pattern #"(?i)(<title.*?>)(.+?)(</title>)"