Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
PuercoPop / blame.sh
Created March 30, 2012 14:14
Presents an aggregated count of the 'blame' of each contributor to a git repository
#!/bin/sh
#
# Execute in the repo root dir
#
git ls-tree -r HEAD | awk '{print $4}' | tr -s '\n' ' ' | xargs -n 1 git blame| awk '{print $1,$2,$3,$4,$5,$6,$7}' | gsed -r 's/.*\((.*?) [0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/p' | sort | uniq -c | sort -r
@PuercoPop
PuercoPop / gist:2332771
Created April 7, 2012 23:18
card app model
class Gifts(models.Model):
"""
Represents the relationship between a Card, and Accounts
"""
#created_by?
number of coupons
@PuercoPop
PuercoPop / pre-commit
Created April 10, 2012 04:33
Git pre-commit hook
#!/bin/sh
ack '# TODO' apps --ignore-dir=common > TODO
git add ${GIT_DIR}/TODO
@PuercoPop
PuercoPop / Populate circuits
Created June 5, 2012 23:42
small snippet to replicate circuits in development database
import random
from circuits.models import Circuit
from user_profile.models import UserProfile
circuits = Circuit.objects.all()
users = UserProfile.objects.all()
countdown = 1
while countdown > 0:
circuit = random.choice( circuits )
@PuercoPop
PuercoPop / Populate circuits
Created June 6, 2012 00:58 — forked from gnrfan/Populate circuits
small snippet to replicate circuits in development database
import random
from circuits.models import Circuit
from user_profile.models import UserProfile
circuits = Circuit.objects.all()
profiles = UserProfile.objects.all()
countdown = 100
while countdown > 0:
circuit = random.choice( circuits )
@PuercoPop
PuercoPop / convert to utf
Created July 20, 2012 00:22
Script to find the files that aren't encoded in uft-8 and do so
file -i `find templates/ | xargs` | sed -r '/charset=utf-8/d' | sed -r '/charset=binary/d'
(defadvice zap-to-char (after zap-up-to-char-advice (arg char) activate)
"Kill up to the ARG'th occurence of CHAR, and leave CHAR. If
you are deleting forward, the CHAR is replaced and the point is
put before CHAR"
(insert char)
(if (< 0 arg) (forward-char -1)))
@PuercoPop
PuercoPop / bencode.clj
Created September 30, 2012 23:14
bencoding/decoding functions in clj
(ns clj_torrent.bencode
(:require [clojure.string :as string]))
(defn decode-bstring [bstring]
"Decodes a bencoded string. It ensures the length matches the content."
(let [[length content] (string/split bstring #":" 2)]
(when (= (Integer/parseInt length) (.length content))
content)))
(defn decode-binteger [binteger]
//context of TrackingPixelList.txt
var mydata1 = "hello ";
var mydata2 = "fox jumps over ";
var mydata3 = "the lazy dog";
// end of text file
<iframe id="RSIFrame" name="RSIFrame" scrolling="no" width="305" height="280" allowTransparency="true" frameborder="0" marginheight="0" marginwidth="0"></iframe>
<script type="text/javascript" src="styles/jquery-1.8.2.min"></script>
<script type="text/javascript">
$(document).ready(function() {
var currentUrl= window.location.pathname;
var iframe = document.getElementById("RSIFrame");
var currentPathname = iframe.src
$.ajax({
url: "https://forms.netsuite.com/app/site/crm/externalleadpage.nl",
method: "GET",