Skip to content

Instantly share code, notes, and snippets.

View aculich's full-sized avatar
😀
Having fun exploring repos for Computational Text Analysis with D-Lab CTAWG

Aaron Culich aculich

😀
Having fun exploring repos for Computational Text Analysis with D-Lab CTAWG
View GitHub Profile
@wjn
wjn / XSLTHashGenerator.xslt
Created February 27, 2014 16:40
Generates an alpha numeric hash of a specified length using xslt 1. 0 and exlt math library.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:math="http://exslt.org/math"
extension-element-prefixes="math">
<xsl:template name="makeHash">
<xsl:param name="length">8</xsl:param>
<xsl:param name="count" select="$length"/>
<xsl:param name="hash"/>
<xsl:variable name="possibleFirst">xABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</xsl:variable>
import Prelude hiding (head)
import Data.Enumerator
import Control.Monad.IO.Class
sum1 :: [Int] -> Int
sum1 [] = 0
sum1 (x:xs) = x + sum xs
getNumber :: IO (Maybe Int)
getNumber = do
@davemo
davemo / app.js
Created May 3, 2011 21:43
A way to add declarative bindings using jQuery and a simple module pattern.
// Given a simplified module pattern like so:
(function(APP, $, _) {
APP.MyWidget = function(opts) {
var self = {};
var defaults = {
// an array of contexts and declarative event bindings
bindings : [
{
@krgn
krgn / gist:972202
Created May 14, 2011 13:18
ant and android - macro to kill, uninstall, install and then launch an app. requires a simple setting of "main-activity" in projects build.xml
<macrodef name="install-helper">
<sequential>
<echo>Killing the running app...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="shell" />
<arg value="killall" />
<arg value="${manifest.package}" />
</exec>
<echo>Uninstalling previous version for clean slate...</echo>
@ivant
ivant / Makefile
Created July 10, 2011 05:12
wc using Data.Enumerator
.PHONY: all clean test
DATA_REPEATS?=1000
DATA_FILE?=/usr/share/dict/words
GHC_OPTS?=-fspec-constr-count=64 -funfolding-use-threshold=64
all: wce wci
clean:
rm -f wce wci *.hi *.o
@inky
inky / feed.rb
Created September 16, 2011 13:19
Some useful Jekyll tags for generating RSS/Atom feeds.
require 'nokogiri'
require 'uri'
module FeedTags
def absolute_url(url, base='/')
return url if url.match /^(javascript|data):/
root = @context.registers[:site].config['home']
URI.join(root, base, url).to_s
end
@suhailshergill
suhailshergill / magit.el
Created July 18, 2012 03:00
magit: buffer label
(defun su/magit/format-magit-status-buffer-name ()
"Append the value of current branch to `magit-status' buffer"
(let ((magit-status-buffer-name (buffer-name (magit-find-status-buffer)))
(branch-name (magit-get-current-branch))
(buffer-name-regex "^\\(\\*.*\\*\\)\\(.*\\)?$"))
(dolist (buffer-name `(,magit-status-buffer-name ,magit-log-buffer-name))
(string-match buffer-name-regex buffer-name)
(ignore-errors (with-current-buffer buffer-name
(rename-buffer (replace-match (concat "\\1" (format
(require 'url)
(defun get-and-parse-json (url)
(interactive)
(with-current-buffer (url-retrieve-synchronously url)
(goto-char (point-min))
(re-search-forward "^$")
(json-read)))
(defun get-movie-json (title &optional year)
@aculich
aculich / aws_repoint_to_my_ip.sh
Last active October 26, 2015 21:36 — forked from hibernado/aws_repoint_to_my_ip.sh
Repoint AWS EC2 Security Group inbound access to my current IP address
#!/bin/bash
# Summary:
# Bash script repoints all inbound access for a given AWS EC2 security group
# to your current IP addr(v4) as provided by ifconfig.me/ip
# To use this script:
# Pass the name of a security group as a command line argument
# e.g. $ aws_repoint_to_my_ip.sh SECURITYGROUPNAME