Skip to content

Instantly share code, notes, and snippets.

@pathawks
pathawks / gitio
Last active August 29, 2015 14:09
Git.io Short URLs from Command Line
#!/bin/sh
if [ "$#" -eq 2 ]; then
curl -i http://git.io -F "url=$1" -F "code=$2" 2>/dev/null | grep 'Location' | sed 's/.*: //'
elif [ "$#" -eq 1 ]; then
curl -i http://git.io -F "url=$1" 2>/dev/null | grep 'Location' | sed 's/.*: //'
else
echo "Syntax error"
fi
@pathawks
pathawks / keybase.md
Last active August 29, 2015 14:07
Keybase Proof

Keybase proof

I hereby claim:

  • I am pathawks on github.
  • I am pathawks (https://keybase.io/pathawks) on keybase.
  • I have a public key whose fingerprint is D97C 9D17 D3D7 6B6F 3255 5A6B F174 6FF5 F18B 3D1B

To claim this, I am signing this object:

; no-ion.inc
; Renames common Ion calls to the MirageOS equivilant
_cleargbuf = _GrBufClr
graph_mem = gbuf
progstart = 9D95h
ionRandom = irandom
ionPutSprite = isprite
ionLargeSprite = ilsprite
@pathawks
pathawks / allPrimes.c
Last active April 8, 2018 18:33
allPrimes
/**
* @author: Pat Hawks
* Created on: Aug 28, 2014
* Source File: allPrimes.c
*/
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
@pathawks
pathawks / cdnjs.rake
Created August 9, 2014 13:47
Sync current CDNjs libraries to a YAML file in Jekyll
require 'rubygems'
require 'net/https'
require 'uri'
require 'json'
require 'yaml/store'
require 'jekyll'
desc "Update CDNjs Libraries"
task :updatecdnjs do
site = Jekyll.configuration({})
@pathawks
pathawks / slide.js
Created March 17, 2014 13:51
GPU Accelerated Slides in jQuery
jQuery.fn['slideToggle'] = function( speed, easing, callback ) {
if (jQuery(this).height()) {
jQuery(this).css('transition', 'all .3s').css('overflow','hidden').css('height','0');
} else {
jQuery(this).css('transition', 'all .3s').css('overflow','hidden').css('height',jQuery(this).prop('scrollHeight')+'px');
}
};
jQuery.fn['slideUp'] = function( speed, easing, callback ) {
jQuery(this).css('transition', 'all .3s').css('overflow','hidden').css('height','0');
@pathawks
pathawks / pygments.scss
Created January 27, 2014 03:42
GitHub Pygments
// Colors
$comment: #999988;
$special: #999999;
$generic: #000000;
$keyword: #000000;
$string: #dd1144;
$name: #990000;
$number: #009999;
$variable: #008080;
@pathawks
pathawks / content-emoji.html
Last active January 2, 2016 11:09
Jekyll include to replace ASCII smileys with emoji
{{ content | replace:'<span>:p</span>','<span class="emoji">&#128541;</span><span class="noemoji">:p</span>' | replace:'<span>;p</span>','<span class="emoji">&#128540;</span><span class="noemoji">:p</span>' | replace:'<span>;)</span>','<span class="emoji">&#128521;</span><span class="noemoji">;)</span>' | replace:'<span>:D</span>','<span class="emoji">&#128515;</span><span class="noemoji">:D</span>' | replace:'<span>:)</span>','<span class="emoji">&#128512;</span><span class="noemoji">:)</span>' | replace:'<span>(:</span>','<span class="emoji">&#128512;</span><span class="noemoji">(:</span>' | replace:'<span>X(</span>','<span class="emoji" title="Persevering Face">&#128547;</span><span class="noemoji">X(</span>' | replace:'<span>:(</span>','<span class="emoji" title="Disappointed Face">😞</span><span class="noemoji">:(</span>' }}
@pathawks
pathawks / Change Author.sh
Last active December 20, 2015 19:59 — forked from jeresig/gist:199298
Change author information in past commits
#!/bin/sh
# Rename an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
git filter-branch -f --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
<?php /* With apologies to Dr. Drang and John Siracusa.
feed-subscribers.php
By Marco Arment.
Released into the public domain with no warranties and no restrictions.
Usage: Pipe an Apache access log into stdin, e.g.:
php -f feed-subscribers.php < /var/log/httpd/access_log