Skip to content

Instantly share code, notes, and snippets.

View Widdershin's full-sized avatar

Nick Johnstone Widdershin

View GitHub Profile
@Widdershin
Widdershin / ci.py
Last active December 20, 2015 22:49
A wrapper for Chocolatey's cinst, to allow searching. Usage: ci (search/package name)
"""
ci.py
A wrapper for Chocolatey's cinst, to allow searching.
Usage: ci (search/package name)
"""
import os
import sys
@Widdershin
Widdershin / subl.reg
Created August 13, 2013 03:05
Registry file for adding "Open Folder with Sublime Text 3" to shell
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Open Folder with &Sublime Text 3]
@="Open Folder with &Sublime Text 3"
[HKEY_CLASSES_ROOT\Directory\shell\Open Folder with &Sublime Text 3\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""
@Widdershin
Widdershin / query.py
Created November 4, 2013 10:40
Query Board
###### IO Boilerplate ######
import sys
if len(sys.argv) < 2:
input_file_name = "23-queryboard-in.txt"
else:
input_file_name = sys.argv[1]
with open(input_file_name) as input_file:
@Widdershin
Widdershin / skatesanta.py
Last active December 31, 2015 14:09
The code to generate matches for /r/longboarding's gift exchange
import fuckitdb
import os
import random
email = os.environ["FUCKITDB_EMAIL"]
password = os.environ["FUCKITDB_PASSWORD"]
database = fuckitdb.Database("SecretSanta", email, password)
@Widdershin
Widdershin / perl.py
Created December 30, 2013 01:27
Hack for unix/perl style find and replace in Python
import inspect
class Find(object):
def __div__(self, find_term):
frame = inspect.stack()[0][0].f_back
line = inspect.getframeinfo(frame)[3][0]
equal_index = line.index("=")
variable_name = line[:equal_index - 1].strip()
@Widdershin
Widdershin / logsplat.py
Last active January 2, 2016 10:39
Concatenates all log files in directory into one file, sorted by timestamp.Usage: logsplat.py directory
"""
Concatenates all log files in directory into one file, sorted by timestamp.
Usage: logsplat.py directory
"""
import collections
import glob
import os
from operator import attrgetter
@Widdershin
Widdershin / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:57 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
def sign(number)
if number > 0
return 1
elsif number < 0
return -1
end
0
end
@Widdershin
Widdershin / agnoster.zsh-theme
Last active June 23, 2016 14:24
agnoster with newlines
# If you're using antigen, run the following line to apply the theme. Add it to your zshrc if you want it to be permanent.
# antigen theme https://gist.github.com/Widdershin/a080ec7a6af0f943f40f agnoster
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
@Widdershin
Widdershin / Rakefile
Created June 14, 2014 10:16
EDA Rakefile
require 'rake'
require 'rspec/core/rake_task'
require ::File.expand_path('../config/environment', __FILE__)
# Include all of ActiveSupport's core class extensions, e.g., String#camelize
require 'active_support/core_ext'
namespace :generate do
desc "Create an empty model in app/models, e.g., rake generate:model NAME=User"
@Widdershin
Widdershin / application.js
Last active August 29, 2015 14:02
EDA Portfolio Challenge 6 - JS Refactor
$(document).ready(function () {
DiceController = {
dice: [],
$diceContainer: $('.dice'),
addDie: function () {
die = new Die ();
this.dice.push(die);
this.$diceContainer.append(die.rootNode());