Skip to content

Instantly share code, notes, and snippets.

## ffmpeg encoding for Twilio, Genesys and other voice delivery platforms
## File input can be any format ffmpeg accepts (.mp3, .wav, .avi, etc.), output shout should be .wav format
ffmpeg -i "YOUR_INPUT_FILE.m4a" -ar 8000 -ac 1 -ab 64 -acodec pcm_mulaw "YOUR_OUTPUT_FILE.wav" -map 0:0
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@radiospiel
radiospiel / localpod.mdown
Created March 9, 2012 22:41
How I use Cocoapod locally
  1. Preparation

Setup a local CocoaPods directory, and register it with CocoaPods

mkdir -p ~/CocoaPods/Local
(cd ~/CocoaPods/Local; git init)
pod repo add ~/CocoaPods/Local
  1. Update local CocoaPod
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active March 31, 2024 18:45 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@ttscoff
ttscoff / rtftomarkdown.rb
Created October 9, 2012 21:05
Convert RTF/DOC files to Markdown via Textutil
#!/usr/bin/ruby
=begin
Usage: rtftomarkdown.rb FILENAME.rtf
Uses textutil, available on Mac only (installed by default)
Outputs to STDOUT
Notes:
Links are replaced with Markdown references (duplicate links combined).
@chrix2
chrix2 / pkcs7.py
Created November 29, 2012 19:40
Padding PKCS7 on python
import binascii
import StringIO
class PKCS7Encoder(object):
def __init__(self, k=16):
self.k = k
## @param text The padded text for which the padding is to be removed.
# @exception ValueError Raised when the input padding is missing or corrupt.
def decode(self, text):
@yoavram
yoavram / client.py
Created December 21, 2012 08:41
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
anonymous
anonymous / scrypt_password.py
Created September 26, 2013 13:54
An answer to http://stackoverflow.com/questions/13654492/how-to-use-scrypt-to-generate-hash-for-password-and-salt-in-python How to generate and check a password hash with scrypt and python.
import struct
from binascii import b2a_base64 as e64
from binascii import a2b_base64 as d64
import scrypt
import Crypto.Random
random = Crypto.Random.new().read
from passlib.utils import consteq
_PARAMS = struct.Struct("!BBBB")
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonHMAC.h>
+ (NSString*)hmacsha1Hexdigest:(NSString*)data key:(NSString*)key
{
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
const char *cData = [data cStringUsingEncoding:NSUTF8StringEncoding];
uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0};
CCHmac(kCCHmacAlgSHA1, cKey, strlen(cKey), cData, strlen(cData), digest);
@tvervest
tvervest / ExtendedBarButtonItem.h
Created January 30, 2014 13:38
A drop-in replacement for the UIBarButtonItem class which passes the set target and action to the custom view if it is a UIControl. As I grew tired of having to pay attention to UIBarButtonItem objects having custom (control) views, I wrote an extending class which actually behaves the way (I think) the parent class should. All you have to do is…
//
// ExtendedBarButtonItem.h
//
// Created by Thomas Vervest.
// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
// http://creativecommons.org/licenses/by-sa/4.0/
//
#import <UIKit/UIKit.h>