Skip to content

Instantly share code, notes, and snippets.

View rpavlik's full-sized avatar

Rylie Pavlik rpavlik

View GitHub Profile
@technoweenie
technoweenie / github_oauth_busy_developer_guide.md
Created May 30, 2010 18:34
GitHub OAuth Busy Developer's Guide

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
@mastbaum
mastbaum / ftrapv.cpp
Created June 2, 2011 16:38
A demonstration of GCC's ftrapv flag for C++ integer overflow debugging
#include<iostream>
#include<signal.h>
#include<limits.h>
/** g++'s -ftrapv flag provides some protection against integer overflows. It
* is a little awkward to use, though. All it will do is "trap" -- you must
* provide a signal handler to deal with it.
*
* (You must compile with -ftrapv for this to work)
*/
@rpavlik
rpavlik / mtclasses.lua
Created December 7, 2011 19:08
Quickie example for object-style programming Lua
--See http://www.lua.org/pil/16.html and http://www.lua.org/pil/16.1.html for more information
--Table for all "methods" shared between "objects"
local objMTindex = {}
--method called "greet"
function objMTindex:greet()
print("Hello from ", self, "aka", self.aka)
self.greeted = true
end
@bryanveloso
bryanveloso / brew-services.rb
Created December 8, 2011 09:39 — forked from lwe/brew-services.rb
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist. (This version fixes the deprecation warning raised on Formula.resolve_alias.)
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
@rpavlik
rpavlik / portbranch.sh
Created January 11, 2012 20:25
Script for moving branches from one git-svn mirror to a new one
#!/bin/bash
# Call like ./portbranch official-upstream/3.0 my-3.0-fixes
# Original Author:
# 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2012.
# Distributed under the Boost Software License, Version 1.0.
anonymous
anonymous / libclang_show_ast.py
Created April 26, 2012 21:03
Show the AST of a translation unit with libclang and python
# inspired by http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-with-clang/
import sys
import clang.cindex
def verbose(*args, **kwargs):
'''filter predicate for show_ast: show all'''
return True
def no_system_includes(cursor, level):
'''filter predicate for show_ast: filter out verbose stuff from system include files'''
@jboner
jboner / latency.txt
Last active May 10, 2024 14:27
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@rpavlik
rpavlik / dfu-unor3-patch.diff
Created July 31, 2012 15:43
dfu-programmer diff to add alternate product ID for arduino usbserial chip.
Index: src/arguments.c
===================================================================
--- src/arguments.c (revision 105)
+++ src/arguments.c (working copy)
@@ -72,6 +72,7 @@
{ "at90usb647", tar_at90usb647, adc_AVR, 0x2FF9, 0x03eb, 0x10000, 0x2000, true, 128, true, false, 128, 0x0800 },
{ "at90usb646", tar_at90usb646, adc_AVR, 0x2FF9, 0x03eb, 0x10000, 0x2000, true, 128, true, false, 128, 0x0800 },
{ "at90usb162", tar_at90usb162, adc_AVR, 0x2FFA, 0x03eb, 0x04000, 0x1000, true, 128, true, false, 128, 0x0200 },
+ { "at90usb162unor3",tar_at90usb162, adc_AVR, 0x2FEF, 0x03eb, 0x04000, 0x1000, true, 128, true, false, 128, 0x0200 },
{ "at90usb82", tar_at90usb82, adc_AVR, 0x2FF7, 0x03eb, 0x02000, 0x1000, true, 128, true, false, 128, 0x0200 },
@rpavlik
rpavlik / findjava.js
Created August 21, 2012 22:31
Finding java once and for all - no batch file nonsense
getJRE = function(ver, wantJDK) {
var wshShell = new ActiveXObject("WScript.Shell");
var key = "HKLM\\SOFTWARE\\JavaSoft\\" +
(wantJDK ? "Java Development Kit\\" : "Java Runtime Environment\\") +
ver +
"\\JavaHome";
//WScript.Echo(key);
try {
@rpavlik
rpavlik / .gitignore
Created November 15, 2012 22:38
Updater/package manager scripts for Cygwin
/setup.exe
/Cygwin.bat
/Cygwin.ico
/Cygwin-Terminal.ico
/packages/
/bin/
/cygdrive/
/dev/
/etc/
/home/