Skip to content

Instantly share code, notes, and snippets.

View huffman's full-sized avatar

Ryan Huffman huffman

View GitHub Profile
--- file_templates.vba 2011-02-24 22:53:45.000000000 -0800
+++ file_templates_updated.vba 2011-02-24 22:54:15.000000000 -0800
@@ -165,6 +165,7 @@
\ '$LBASENAME$': tolower(expand('%:t:r')),
\ '$YEAR$': strftime("%Y"),
\ '$DATE$': strftime('%d/%m/%Y'),
+ \ '$FULLDATE$': strftime('%d %b %Y'),
\ }
let [lnum, cnum] = searchpos(s:VarTagMatch)
@huffman
huffman / elixir.rb
Created March 2, 2012 03:50
Elixir Homebrew recipe
# Install this recipe with:
# brew install --HEAD https://raw.github.com/gist/1955470/c58bda92f07147afff64a86d0c2d8ef65adb9cd6/elixir.rb
require 'formula'
class Elixir < Formula
homepage 'http://elixir-lang.org/'
head 'https://github.com/elixir-lang/elixir.git'
depends_on 'erlang'
day = 1
year = 1900
mons = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
fom_sundays = 0
def is_leap_year(year):
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
while year < 2001:
from math import factorial
digits = "0123456789"
target = 1000000
def lex(perm, values):
vlen = len(values)
for i in xrange(vlen):
num_perms = factorial(vlen - i)
if perm >= num_perms:
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# Euler published the remarkable quadratic formula:
#
# n² + n + 41
#
# It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41² + 41 + 41 is clearly divisible by 41.
#
# Using computers, the incredible formula n² − 79n + 1601 was discovered, which produces 80 primes for the consecutive values n = 0 to 79. The product of the coefficients, −79 and 1601, is −126479.
@huffman
huffman / c.c
Created September 8, 2012 05:08
// Compiled with -O3
// cat C-large-practice.in 0.00s user 0.00s system 81% cpu 0.003 total
// ./a.out 4.18s user 0.13s system 99% cpu 4.318 total
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NOT_FOUND 0xFFFFFFFF
#define MAX_PRISONERS 10000
@huffman
huffman / a.py
Created September 20, 2012 03:39
GCJ 2008 Qualification
#!/usr/bin/env python
from sys import stdin
from sets import Set
for case in xrange(int(stdin.readline())):
num_engines = int(stdin.readline())
engines = []
for _ in xrange(num_engines):
engines.append(stdin.readline())
@huffman
huffman / gist:8fc4f10c4c80d5982034
Created January 9, 2015 00:48
VS 2013 interface libraries
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
@huffman
huffman / eval.js
Last active August 29, 2015 14:14
Self evaluating entity script
(function(){
print("Loading self evaluating entity script");
this.preload = function(entityID) {
var properties = Entities.getEntityProperties(this.entityID);
eval(properties.userData);
}
});
@huffman
huffman / letThereBeLight.js
Created February 27, 2015 23:46
letThereBeLight.js
//
// SunLightExample.js
// examples
// Sam Gateau
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//