Skip to content

Instantly share code, notes, and snippets.

var Wav = function(opt_params){
/**
* @private
*/
this._sampleRate = opt_params && opt_params.sampleRate ? opt_params.sampleRate : 44100;
/**
* @private
*/
@0x07dc
0x07dc / VenmoPaymentRequest
Last active August 29, 2015 14:02
A function to send a request for payment through Venmo, based on http://davidwalsh.name/curl-post and using the Venmo API
function sendPaymentRequest($email,$amount){
//http://davidwalsh.name/curl-post
//set POST variables
$url = 'https://api.venmo.com/v1/payments';
$access_token = ; // use your access token
$phone = $email; // This is email address, phone number, or user id (I think -- email addresses are common)
$note = "This is a request for a payment of $".$amount." for ...";
$amount = $amount;
$audience = 'private';// chose audience
@0x07dc
0x07dc / gist:4384257663a524f6c818
Last active August 29, 2015 14:16
Find all .js and .css files and run yuicompressor to minify (bash)
print contents of .css:
find /home/user/appfolder/ | grep '\.css' | while read -r i; do cat $i; done
print contents of .js:
find /home/user/appfolder/ | grep '\.js' | while read -r i; do cat $i; done
print contents of .js or .css:??
find /home/user/appfolder/ | grep '\.c{0,1}[sj]s$' | while read -r i; do cat $i; done
css:
@0x07dc
0x07dc / mysql_copyTables
Created March 29, 2015 03:44
Copy tables in MySQL
# Drawn from http://stackoverflow.com/a/15649857/2016196
# To make a new table
CREATE TABLE YourNewTable
SELECT *
FROM mygrist_tables
WHERE suic_att>=5 AND gender='M';
# To copy to an existing table
INSERT INTO YourNewTable
@0x07dc
0x07dc / gist:a22ebf2e84c55ab69e2d
Created May 9, 2015 17:39
Remove all plugins from Cordova project
# May need to run multiple times to settle dependencies
cordova plugin ls | grep -o "^\S*" | while read i;do cordova plugin rm $i; done;
@0x07dc
0x07dc / pandoraSleepTimer.js
Last active October 7, 2020 15:53
Pandora website sleep timer
// This is a sleep timer for Pandora. To work this, just copy this entire file to notepad,
// edit the number at the bottom where it says, "Sleep time in minutes," putting
// how many minutes you'd like, then copy all of that, go to Pandora,
// press F12, then in the box near the bottom of the window that shows up, paste the code and
// press enter.
// This is useful if you need a sleep timer for Pandora.
// If this stops working, or if you'd like a sleep timer on a different site,
// try to find something like a pause or mute button, then right-click it,
// select "inspect" (in Chrome -- not sure what it says in other browsers)
@0x07dc
0x07dc / windowsSleepTimer.py
Last active April 9, 2023 15:21
Windows Audio Sleep Timer
# This script mutes your windows audio after a certain amount of entered time
# Requires PyCaw (>pip install pycaw)
# Usage:
# > python sleepTimer.py <minutes until silence>
import sys
if(len(sys.argv)<2):
exit("Error. No countdown time provided")
@0x07dc
0x07dc / sleepTimer.bat
Last active October 8, 2020 05:51
Batch file to simplify running windowsSleepTimer.py
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
:: windowsSleepTimer.py is in a folder called deps in this implementation
:: this folder is in the same folder as windowsSleepTimer.py
::
:: Usage:
:: To control time until audio silence:
:: > sleepTimer.bat <minutesUntilSilence>
:: To use the default setting:
:: > sleepTimer.bat
:: Example:
@0x07dc
0x07dc / dft.cpp
Created October 10, 2020 01:15
DFT
// This is a function that performs the discrete fourier transform
// on an input array and returns a magnitude from 0-1 indicating
// detection strength (1 being prominent and 0 being silent)
// Additionally, it's also implemented here as an example
#include <iostream>
#include <math.h>
#define _USE_MATH_DEFINES
using namespace std;
@0x07dc
0x07dc / PhonemeBasedParagraphGenerator.py
Last active February 18, 2023 20:23
Python Script to Generate Pseudo-language Paragraphs
################################################################
# Author: Jamil Voss (2023)
# MIT License (free to use open-source license)
# Language: Python
# About:
# Python script to generate random pseudo-language paragraph.
# Uses arrays of vowel and consonant phonemes and
# a normally distributed random index generator
# to concatenate phonemes.
#