Skip to content

Instantly share code, notes, and snippets.

View supermethod's full-sized avatar

Chris Toppon supermethod

View GitHub Profile
@alastairmccormack
alastairmccormack / iframe-probe.py
Last active April 17, 2024 01:35
Shows GOP structure for video file using ffmpeg --show-frames output
#!/usr/bin/env python
#
# Shows GOP structure of video file. Useful for checking suitability for HLS and DASH packaging.
# Example:
#
# $ iframe-probe.py myvideo.mp4
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
@SaschaMoellering
SaschaMoellering / gist:89b5046eeb776ca233b0
Created January 23, 2015 19:36
Clustered Redis in multiple AZs in a VPC with replication
def create_redis_cluster(region, infrastructure_name, security_groups, subnet_ids, availability_zones,
cache_node_type):
cluster_name = "{0}-cache-cluster".format(infrastructure_name)
replication_group = "{0}-rg".format(infrastructure_name)
cluster_subnet = "{0}-cluster-subnet".format(infrastructure_name)
print "Creating Redis cluster {0} using security groups {1} and subnet {2} in AZs {3} with cache node type {4}"\
.format(cluster_name, security_groups, subnet_ids, availability_zones, cache_node_type)
@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@samnang
samnang / gist:1759336
Created February 7, 2012 11:52
Install Bash version 4 on MacOS X
# Install Bash 4 using homebrew
brew install bash
# Or build it from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells
@snit-ram
snit-ram / RecursiveArrayIterator.php
Created September 27, 2011 02:18
Recursive Object iterator that reads protected and private properties
<?php
class ObjectIterator implements Iterator{
protected $object;
protected $reflectionObject;
protected $properties;
public function __construct( $object ){
$this->object = $object;
@stefl
stefl / gist:888150
Created March 26, 2011 09:04
extract starting timecode from a video file using mediainfo
mediainfo -f /files/timecode/528006c9-33b0-4a89-9b94-c9bf7f6be2a9.mov | grep '^Delay.*: [0-9][0-9]:' | awk '{split($0,a,": "); print a[2]}'
@joemccann
joemccann / phonegap_sencha_tutorial.md
Created January 31, 2011 20:19
Quick setup of Phonegap and Sencha tutorial.

Note: You need to be on a Mac.

Note: This is purposely verbose. Yes, I know a lot of this can be simplified. Fork it and show me.

  1. Install git
  2. Open your terminal.
  3. mkdir ~/Documents/phonegap_sencha
  4. cd ~/Documents/phonegap_sencha
  5. git clone https://github.com/phonegap/phonegap-iphone.git && cd phonegap-iphone
  6. git reset --hard HEAD