Skip to content

Instantly share code, notes, and snippets.

View groveriffic's full-sized avatar

Sam Ehlers groveriffic

View GitHub Profile
@groveriffic
groveriffic / pg_hba.conf
Created November 21, 2012 00:22
Postgres allows any user to connect from localhost to localhost
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
@groveriffic
groveriffic / curl_syntax.py
Created October 1, 2018 16:26
Prints out a command line curl from the same inputs your would have used with requests
def curl_syntax(url, params=[], headers=[]):
print(url, params, headers)
from urllib.parse import urlencode
print('curl \\')
print(' --verbose \\')
for k in sorted(headers.keys()):
v = headers[k]
print(' --header "{}: {}" \\'.format(k, v))
params_array = []
for k in sorted(params.keys()):
@groveriffic
groveriffic / mathlink.rb
Created August 31, 2012 03:33
jruby-mathlink
@groveriffic
groveriffic / unit_circle.html
Created March 16, 2017 19:02
Using the stock web stack to refresh my understanding of Trigonometry
<html>
<head>
<title>Trigonometry in the Unit Circle</title>
<style>
circle, line {
fill: none;
stroke: black;
stroke-width: 0.01;
}
-- Prerequisites:
-- Boto: sudo pip install boto
-- Boto Config File: see https://code.google.com/p/boto/wiki/BotoConfig
-- Add PL Language Extensions
CREATE EXTENSION IF NOT EXISTS plpythonu;
CREATE OR REPLACE FUNCTION _s3_get(bucket text, key text)
RETURNS bytea AS $$
#!/bin/bash
git checkout master
git pull
git branch --remotes --merged | grep origin > .master_merged
git checkout release-staging
git pull
git branch --remotes --merged | grep origin > .staging_merged
diff .master_merged .staging_merged
rm .master_merged .staging_merged
@groveriffic
groveriffic / affine_edit.elm
Last active December 4, 2015 23:00
Edit affine transformations with mouse and keyboard in Elm
import Color exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Mouse
import Keyboard
import Char
import Signal
import Transform2D
import Time
package main
import (
"fmt"
"log"
)
type point struct {
x int
y int
package main
import (
"fmt"
"log"
)
// String Concatenation Monoid
var identity string = ""
var mappend = func(a, b string) string {
package main
import (
"fmt"
"log"
)
// A monoid that combines sum and count to calculate an average
type average struct {
sum int