Skip to content

Instantly share code, notes, and snippets.

@gerrymanoim
gerrymanoim / IForestIndex.ipynb
Created March 30, 2021 04:17
Python implementation of IForestIndex
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gerrymanoim
gerrymanoim / callbacks.py
Created August 8, 2020 22:05
All the code for generic callbacks in airflow
import json
from collections import namedtuple
from functools import lru_cache
from pathlib import Path
from typing import List
import jinja2
import yaml
from airflow import configuration
@gerrymanoim
gerrymanoim / modern_python_dictionaries.py
Created August 6, 2020 22:08
Code from Modern "Python Dictionaries A confluence of a dozen great ideas - Raymond Hettinger"
import array
import collections
import itertools
# Placeholder constants
FREE = -1
DUMMY = -2
class Dict(collections.MutableMapping):
'Space efficient dictionary with fast iteration and cheap resizes.'
#!/bin/bash
: '
my-script — does one thing well
Usage:
my-script <input> <output>
Options:
<input> Input file to read.
<output> Output file to write. Use '-' for stdout.
@gerrymanoim
gerrymanoim / archtober.md
Created August 14, 2018 03:10
Get Archtober Events
import requests
import pandas as pd
from bs4 import BeautifulSoup
from datetime import date

Can't use requests for whatever reason (403 denied). Instead, in console:

var output = document.getElementById('output');
function assert( outcome, description ) {
var li = document.createElement('li');
li.className = outcome ? 'pass' : 'fail';
li.appendChild( document.createTextNode( description ) );
output.appendChild(li);
};
@gerrymanoim
gerrymanoim / Default (Linux).sublime-keymap
Created August 31, 2011 19:20 — forked from coldnebo/Default (Linux).sublime-keymap
simple script to checkout files you want to edit in sublime text 2 using P4
[
{ "keys": ["f8"], "command": "p4_edit" }
]
@gerrymanoim
gerrymanoim / gist:1151810
Created August 17, 2011 15:40
Same Routing
(function(routes) {
routes.mapRoute(
"Test", // Name.
"foo/bar/{controller}/{action}/{p1}/{p3}/{p2}", // Path.
{ controller: "Page", action: "Index", p1: "default1", p2: "default2", p3: "default3" } // Defaults.
);
routes.mapRoute(
"Default", // Name.
@gerrymanoim
gerrymanoim / highstock.js
Created July 8, 2011 20:14
Modified highstock to not throw null error
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
/**
* @license Highcharts Stock v1.0 Beta (2011-07-05)
*
* (c) 2009-2011 Torstein Hønsi
*
* License: www.highcharts.com/license
*/
@gerrymanoim
gerrymanoim / data.csv
Created July 8, 2011 15:46
For Highstocks
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
DATE;TIME;VOLUME;OPEN;CLOSE;MIN;MAX
24-09-2003;00:00:01;34756;.8743;.8709;.8692;.8753
25-09-2003;00:00:01;38667;.8708;.872;.8669;.873
26-09-2003;00:00:01;31138;.872;.8714;.8696;.8743
29-09-2003;00:00:01;41579;.8729;.8638;.8592;.8778
30-09-2003;00:00:01;40631;.8639;.8567;.8522;.8643
01-10-2003;00:00:01;36114;.8568;.8536;.8521;.8582
02-10-2003;00:00:01;40193;.8536;.8564;.8498;.8577
03-10-2003;00:00:01;35293;.8562;.8639;.8532;.8659
06-10-2003;00:00:01;37283;.8639;.8538;.853;.8673