Skip to content

Instantly share code, notes, and snippets.

View BenDoyle's full-sized avatar

Ben Doyle BenDoyle

  • Ottawa, Ontario, Canada
View GitHub Profile
@BenDoyle
BenDoyle / gist:5664956
Created May 28, 2013 18:27
sublime settings
{
"color_scheme": "Packages/Color Scheme - Default/Mac Classic.tmTheme",
"font_size": 16.0,
"ignored_packages":
[
"Vintage"
],
"save_on_focus_lost": true,
"tab_size": 2,
"translate_tabs_to_space": true
require 'json'
raw = JSON.parse(File.read(ARGV[0]))
header = raw[0].keys
def values(header, row)
header.map{|h|row[h]}
end
with
p as (
SELECT 1 as id, 1 as t, 'p' as k, 'x' as v
UNION ALL
SELECT 1 as id, 2 as t, 'p' as k, 'y' as v
UNION ALL
SELECT 1 as id, 5 as t, 'p' as k, 'z' as v
),
q as (
SELECT 1 as id, 3 as t, 'q' as k, 'a' as v
Dungeon Crawl Stone Soup version 0.17.1-1 (tiles) character file.
482312 Uhijidghi the Black Sun (level 23, -29/169 HPs)
Began as a Vampire Enchanter on Mar 8, 2016.
Was a High Priest of Kikubaaqudgha.
Killed from afar by a frost giant (51 damage)
... with a bolt of cold
... on level 5 of the Vaults on Mar 28, 2016.
The game lasted 10:38:41 (109459 turns).
@BenDoyle
BenDoyle / init.txt
Created November 29, 2016 01:48
dcss init file
##### Crawl Init file ###############################################
# For descriptions of all options, as well as some more in-depth information
# on setting them, consult the file
# options_guide.txt
# in your /docs directory. If you can't find it, the file is also available
# online at:
# https://gitorious.org/crawl/crawl/source/HEAD:crawl-ref/docs/options_guide.txt
#
# Crawl uses the first file of the following list as its option file:
# * init.txt in the -rcdir directory (if specified)
@BenDoyle
BenDoyle / sequence.sql
Created September 18, 2017 20:31
[presto] query to generate a simple sequence relation
SELECT m FROM UNNEST(sequence(0,23)) as t(m)
@BenDoyle
BenDoyle / building residuals from snapshots.sql
Created December 1, 2017 14:48
[presyo] query to estimate residuals from a fixed rate projection
-- building residuals join based
with
raw as (
SELECT 1 as t, 1 as v
UNION ALL
SELECT 2 as t, 1 as v
UNION ALL
SELECT 3 as t, 1 as v
UNION ALL
@BenDoyle
BenDoyle / flatten.py
Last active March 7, 2019 15:43
[python] flatten function
from functools import reduce
import operator
def flatten(values):
if not values:
return values
return reduce(operator.concat, ([item] if not hasattr(item, '__iter__') else flatten(item) for item in values))
@BenDoyle
BenDoyle / owner.bash
Created May 22, 2019 16:43
incantation to get the email address of the first committer to a file
git log --pretty=format:%ae --diff-filter=A -- <filename>
@BenDoyle
BenDoyle / conform.sql
Last active July 10, 2020 18:22
[SQLite3] td and tangering transactions conforming
CREATE TABLE conformed_transactions
(
source TEXT,
transaction_type TEXT,
transaction_text TEXT,
amount TEXT,
provider_category TEXT,
transaction_date TEXT
)