Skip to content

Instantly share code, notes, and snippets.

View paxswill's full-sized avatar

Will Ross paxswill

View GitHub Profile
@paxswill
paxswill / file-io.cc
Created October 19, 2012 14:43
File I/O
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char ** argv) {
/*
* File streams are used like standard input/output streams are used, with
* the insertion/extraction operators.
@paxswill
paxswill / brew---config.txt
Created July 31, 2012 17:42
broken glib universal on 10.7
HOMEBREW_VERSION: 0.9.2
HEAD: cd77baf2e2f75b4ae141414bf8ff6d5c732e2b9a
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit core2
OS X: 10.7.4-i386
Xcode: 4.4
CLT: 4.4.0.0.1.1249367152
GCC-4.0: N/A
GCC-4.2: N/A
@paxswill
paxswill / brew-config.txt
Created June 13, 2012 02:00
gnu-typist bug report
HOMEBREW_VERSION: 0.9
HEAD: 863292fc7325791b751bd6c3657b4c14a77a5e28
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: N/A
@paxswill
paxswill / remove_crap.sh
Created May 30, 2012 01:37 — forked from anonymous/remove_crap.sh
Remove Crap v2
#
# Script to remove junk from Windows and OS X
#
### Not set up to run as root. Advised not to do this. ###
#### Variables ####
@paxswill
paxswill / gist:2310266
Created April 5, 2012 11:49
Homebrewed Mercurial on Snow Leopard with Xcode 4.2 only.
[paxswill@apollo:~]$ which gcc-4.2
[paxswill@apollo:~]$ brew install -vvd mercurial
==> Downloading http://mercurial.selenic.com/release/mercurial-2.1.2.tar.gz
Already downloaded: /Users/paxswill/Library/Caches/Homebrew/mercurial-2.1.2.tar.gz
/usr/bin/tar xf /Users/paxswill/Library/Caches/Homebrew/mercurial-2.1.2.tar.gz
==> make PREFIX=/usr/local/Cellar/mercurial/2.1.2 build
make PREFIX=/usr/local/Cellar/mercurial/2.1.2 build
python setup.py build
running build
running build_mo
@paxswill
paxswill / xdblint.c
Created February 8, 2012 01:51
xdbglint reformats Apple's gdb output for CoreFoundation collections so that it is indented properly
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
int countBraces(char *str);
int main (int argc, char const *argv[])
{
class Point{
public:
// Public member functions here
int getX(){
return this.x;
}
// Other accessors here
// There are two ways to go about checking equality.
@paxswill
paxswill / ansi-color.rb
Created November 9, 2011 16:03
ansi-color Homebrew Formula
class AnsiColor < Formula
url 'http://ansi-color.googlecode.com/files/ansi-color-0.6.tar.gz'
version '0.6'
homepage 'http://code.google.com/p/ansi-color/'
md5 '7f55561eb9c88bb56f51a86f12bff75c'
def install
# This package is a bit special, and probably requires manual staging/installation
end
end
@paxswill
paxswill / tiny-bubble.c
Created November 4, 2011 06:41
Tiny BubbleSort
/*
This breaks a number of rules, and probably won't work with systems with non-32bit ints
Minimal form (180 chars):
main(){int n,*s,i=0,j,t;scanf("%d",&n);s=malloc(n);while(i<n)scanf("%d",s+i++);while(--i)for(j=0;j<i;)if(s[j]>s[++j]){t=s[--j];s[j]=s[++j];s[j]=t;}while(i<n)printf("%d ",s[i++]);}
Standard(ish) form:
*/
main(){
int n,*s,i=0,j,t;
@paxswill
paxswill / test_rand.c
Created October 5, 2011 00:26
Demonstrate the dangers of calling rand() without calling srand().
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
/*
* Require C99
*/
#if __STDC_VERSION__ < 199901L
#error C99 Required