Skip to content

Instantly share code, notes, and snippets.

View bikemule's full-sized avatar

bikemule

  • Kraken Technologies
  • Brooklyn, NY
View GitHub Profile

docs

To start godoc at log in time (so it always there on port 6060 when you need it):

  1. copy smarticus.godoc.plist to in ~/Library/LaunchAgents
  2. launchctl load ~/Library/LaunchAgents/smarticus.godoc.plist
  3. visit http://localhost:6060
@carljm
carljm / envsettings.py
Created April 13, 2016 19:07
Django settings from env.
"""Utility for pulling settings from the environment."""
import os
from urllib.parse import urlparse
class EnvParser:
"""Utility for getting settings from the OS environ.
Instantiate with the name of an env var to get the current mode from (that
env var should be set to one of VALID_MODES, or not set), then call the
@dkarchmer
dkarchmer / aws-lambda-picture-resize
Created May 20, 2016 04:12
Sample JavaScript code for resizing pictures on AWS Lambda
/**
* This is based on: http://docs.aws.amazon.com/lambda/latest/dg/walkthrough-s3-events-adminuser.html
*/
// dependencies
var async = require('async');
var AWS = require('aws-sdk');
var gm = require('gm').subClass({ imageMagick: true }); // Enable ImageMagick integration.
var util = require('util');
var MAX_WIDTH;
@KeyMaster-
KeyMaster- / polarWarp.glsl
Created April 4, 2015 21:27
Cartesian to Polar coordinates warp shader, for shadertoy.com
//To be used on shadertoy.com
//Uses the image at iChannel0 and warps it into polar coordinates
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 relativePos = fragCoord.xy - (iResolution.xy / 2.0);
vec2 polar;
polar.y = sqrt(relativePos.x * relativePos.x + relativePos.y * relativePos.y);
polar.y /= iResolution.x / 2.0;
polar.y = 1.0 - polar.y;
@gregsadetsky
gregsadetsky / settings.py
Last active May 28, 2021 18:37
See: http://stackoverflow.com/questions/13705328/ -- I was looking for a way to run Selenium tests for a Django app on a staging server hosted on Heroku using a PostgreSQL database. The DjangoTestSuiteRunner creates and destroys the whole database before/after testing, which would not work on Heroku where databases are added via other means (her…
import dj_database_url
TEST_DATABASES = {
'default': dj_database_url.config(env='TEST_DATABASE_URL')
}
# replace path below to point to HerokuTestSuiteRunner class
TEST_RUNNER = 'python.path.to.test_suite_runner.HerokuTestSuiteRunner'
@mzheng
mzheng / venmo_csv.txt
Last active August 27, 2021 16:01
Download Venmo Transactions as CSV
Prerequisite
JQ: brew install jq
Chrome/Safari Inspector
Log in and open https://venmo.com/#yours
Open Chrome/Safari Inspector
Go to Network Tab and filter for 'feed'
Right click and Save "feed" as "venmo_feed.json"
Run in Terminal:
cat venmo_feed.json | jq '.data[] | {actor: .actor.name, target: .transactions[0].target.name, type: .type, message: .message, date: .created_time, amount: .transactions[0].amount}' | jq -s -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' > venmo_feed.csv
@equaliser
equaliser / gist:5194456
Created March 19, 2013 08:18
Arduino MCP4922 SPI DAC demo code
/*
MCP4922 test
Steve Woodward, 2010
most code borrowed from
http://mrbook.org/blog/2008/11/22/controlling-a-gakken-sx-150-synth-with-arduino/
connections
====================================================
+5v > 4922 pin 1
-- Window Function examples
-- PostgreSQL conference South Africa 2018
-- By Willem Booysen
-- Youtube: https://www.youtube.com/watch?v=blHEnrYwySE
-- Create database and templates for demo
DROP DATABASE IF EXISTS WindowFunctions;
CREATE DATABASE WindowFunctions;
@cordery
cordery / heroku_test_runner.py
Created April 24, 2017 20:48
Heroku CI compatible DiscoverRunner class for Django 1.10+ that does not require createdb or dropdb permissions.
import os
from django.test.runner import DiscoverRunner
"""
WARNING: WHEN USED INCORRECTLY THIS TEST RUNNER WILL DROP ALL TABLES IN YOUR PRODUCTION
DATABASE!!!
Heroku does not give users createdb/dropdb permissions, therefore Heroku CI cannot run tests for django.
In order to fix this, use this test runner instead which attempts to minimally override the
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong