Skip to content

Instantly share code, notes, and snippets.

@limitedmage
limitedmage / tangogitbash.reg
Created July 22, 2014 22:56
Save this file as a .reg and run it to have prettier colors in Git Bash in Windows.
REGEDIT4
[HKEY_CURRENT_USER\Console\Git Bash]
"ColorTable00"=dword:0036342E
"ColorTable01"=dword:00A46534
"ColorTable02"=dword:00069A4E
"ColorTable03"=dword:009B930B
"ColorTable04"=dword:000000CC
"ColorTable05"=dword:007B5075
"ColorTable06"=dword:0000A0C4
@limitedmage
limitedmage / soundlight.ino
Created May 7, 2012 15:36
Arduino Soundlight Spectrum
int pins[] = {3, 5, 6, 9, 10, 11};
int cpins = 6;
int val;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() >= cpins) {
@limitedmage
limitedmage / arduino.ino
Created March 30, 2012 02:23
Arduino Soundlight
int pin = 11;
int val;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
val = Serial.read();
int seq[4040];
int dyn[4040];
int n;
int lis() {
// longest increasing subsequence
// for sequence seq of length n
// O(nlgn)
// for longest decreasing subsequence, multiply elements by -1
exp : then
then : or "->" then | or
or : and "||" or | and
and : not "&&" and | not
not : "!" atom | atom
atom : "(" then ")" | bool
bool : "#t" | "#f"
@limitedmage
limitedmage / pyramid.cpp
Created August 24, 2011 16:41
Sierpinski Gasket in OpenGL + GLUT
#include <windows.h>
#include <GL/glut.h>
#include <cstdlib>
#include <ctime>
// menu item
#define MENU_SMOOTH 1
#define MENU_FLAT 0
// Function prototypes
@limitedmage
limitedmage / qubit.py
Created April 27, 2011 23:34
Python Quantum Computing simulator
import math
import random
class Qubit:
def __init__(self, a = 1, b = 0):
'''Initialize a single qubit'''
self.zero = complex(a)
self.one = complex(b)
def xgate(self):
private void CreateAd()
{
#if !DEBUG
AdControl.TestMode = false;
#endif
AdControl ad = new AdControl(
#if DEBUG
"test_client",
"Image480_80",
@limitedmage
limitedmage / .hgignore
Created February 24, 2011 00:29
hgignore file for visual studio
# Ignore file for Visual Studio 2008
# use glob syntax
syntax: glob
# Ignore Visual Studio 2008 files
*.obj
*.exe
*.pdb
*.user
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
settings = IsolatedStorageSettings.ApplicationSettings;
Uri savedpage;
if (settings.TryGetValue("page", out savedpage))
{
Browser.Source = savedpage;
}
if (IsTrialMode())