Skip to content

Instantly share code, notes, and snippets.

View svperfecta's full-sized avatar
👾

Brian Corrigan svperfecta

👾
View GitHub Profile
@spenserhale
spenserhale / git-batch-push.sh
Last active March 5, 2024 19:21
When your repo exceeds upload limit (GitHub 2GB), you can push in batches so you can store up to total size limit. (100GB) (Warning uses force push, ideally should be used for setting up new remote, once)
# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=250
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
else
@xeoncross
xeoncross / smoothing.go
Created February 9, 2017 18:37
Peak detection "Smoothed z-score algo" (in Golang) from http://stackoverflow.com/a/22640362/99923
/*
Settings (the ones below are examples: choose what is best for your data)
set lag to 5; # lag 5 for the smoothing functions
set threshold to 3.5; # 3.5 standard deviations for signal
set influence to 0.5; # between 0 and 1, where 1 is normal influence, 0.5 is half
*/
// ZScore on 16bit WAV samples
func ZScore(samples []int16, lag int, threshold float64, influence float64) (signals []int16) {
//lag := 20
import os
import boto.utils
import boto3
import requests
import datetime
import time
def get_contents(filename):
anonymous
anonymous / marshal.js
Created December 31, 2012 06:20
NodeJS module to allow unmarshaling of Ruby serialized objects. Works fine for simple objects, but there's no clear way to implement classes, etc.
"use strict";
/**
* @author geoff
*/
var Marshal = (function() {
var debug = false;
var symbols;
var marshal_major = 4, marshal_minor = 8;
@ericelliott
ericelliott / env-examples.md
Last active February 6, 2024 20:57
env-examples

Most configuration really isn't about the app -- it's about where the app runs, what keys it needs to communicate with third party API's, the db password and username, etc... They're just deployment details -- and there are lots of tools to help manage environment variables -- not the least handy being a simple .env file with all your settings. Simply source the appropriate env before you launch the app in the given env (you could make it part of a launch script, for instance).

env files look like this:

SOMEVAR="somevalue"
ANOTHERVAR="anothervalue"

To source it:

$ source dev.env # or staging.env, or production.env, depending on where you're deploying to

@trek
trek / unit.js
Created July 22, 2012 02:40
Run your mocha unit tests suite via casper.js
// get a Casper object.
// See http://casperjs.org/
var casper = require('casper').create();
// this will be evaluated inside the context of the window.
// See http://casperjs.org/api.html#casper.evaluate for notes on
// the difference between casper's running environment and the
// DOM environment of the loaded page.
function testReporter(){
// casper is webkit, so we have good DOM methods. You're
@shawnchin
shawnchin / shmemctypes.py
Created September 16, 2011 15:09
shm_open() version of multiprocessing.sharedctypes.RawArray
#
# Based on multiprocessing.sharedctypes.RawArray
#
# Uses posix_ipc (http://semanchuk.com/philip/posix_ipc/) to allow shared ctypes arrays
# among unrelated processors
#
# Usage Notes:
# * The first two args (typecode_or_type and size_or_initializer) should work the same as with RawArray.
# * The shared array is accessible by any process, as long as tag matches.
# * The shared memory segment is unlinked when the origin array (that returned
@svperfecta
svperfecta / gist:1007994
Created June 4, 2011 15:43
Streamworks Player Embed with No Autoplay
<script type="text/javascript" src="http://streamworksflowplayermodifcati.appspot.com/static/player/flowplayer-3.2.0.min.js"></script>
<a href="" style="display:block;width:512;height:384" id="MLGPlayer"></a>
<script>
$f("MLGPlayer", "http://streamworksflowplayermodifcati.appspot.com/static/player/player.swf", {
plugins: {
controls: { streams: "str,stb,halo,cod", autoplay:false },
invideous: { url: 'http://streamworksflowplayermodifcati.appspot.com/static/player/invideous.swf', width: "100%", height: "100%", top: 0, left: 0, pid:3771 },
TMPlugin: { url: "http://static.inplay.tubemogul.com/bootloader/TubeMogulFlowPlayer.swf", playerID: "P-W8J-51Q", trackerIDs: "TD-ASG-WXP", displayName:"Default feed" },