Skip to content

Instantly share code, notes, and snippets.

Miles ttfkam

Block or report user

Report or block ttfkam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ttfkam
ttfkam / pgcrypto.js
Created Apr 12, 2017
Simpler constant list entry, aka, I love multiline strings
View pgcrypto.js
const NAMES = `admintools
auth_delay
auto_explain
bloom
btree_gin
btree_gist
chkpass
citext
cube
dblink
@ttfkam
ttfkam / slice.sql
Last active Dec 16, 2016
Array slice for PostgreSQL
View slice.sql
-- Copyright 2016, Miles Elam <miles@geekspeak.org>
-- MIT License, http://www.opensource.org/licenses/mit-license.php
CREATE OR REPLACE FUNCTION splice(target anyarray, start integer, to_insert anyarray)
RETURNS anyarray LANGUAGE 'sql' IMMUTABLE LEAKPROOF STRICT AS $$
SELECT target[0:start - 1]
|| to_insert
|| target[start:array_length(target, 1)]
$$;
@ttfkam
ttfkam / terminal-icon.svg
Created Sep 4, 2016
Someone said something about a file size strawman...
View terminal-icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ttfkam
ttfkam / pg_geolite2_csv.sql
Last active Jul 28, 2018
GeoLite2 for PostgreSQL
View pg_geolite2_csv.sql
-- GeoLite2 CSV files for use with PostgreSQL 9+
-- by Miles Elam <miles@geekspeak.org>
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
View gist:5229aa2b71aee1df0c03
using namespace std;
struct Node {
int value;
node* left;
node* right;
}
boolean findSum(Node* ref, int prev, int target) {
if (!ref) {
@ttfkam
ttfkam / async_defer_script.js
Last active May 19, 2016 — forked from fearphage/async_defer_script.js
Added check for Opera, loading on DOMContentLoaded instead of load. Event only added if Opera has no native support. Replacing script child instead of insert/remove.
View async_defer_script.js
// ==UserScript==
// @name defer/async for Opera
// @namespace http://d.hatena.ne.jp/edvakf/
// @license Public Domain
// Updated by Miles Elam <miles@geekspeak.org>
// ==/UserScript==
(function(window, document, opera) {
function load_script(script, attr) {
You can’t perform that action at this time.