Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
redis_version=2.6.14
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/richid/5205684/raw/53476c5360702367a59907d04c32822c523fdfac/install-redis.sh
# chmod +x install-redis.sh
# ./install-redis.sh
@buunguyen
buunguyen / ycombinator.bk
Created September 21, 2012 01:29
Y-Combinator in Bike
var Y = func(h) {
return func(f) {
f(f)
}(func(f) {
h(func(n) { f(f)(n) })
});
};
var fact = Y(func(recur) {
return func(n) {
@buunguyen
buunguyen / DynamicHandler.cs
Created July 10, 2012 19:30
Dynamic Handler for .NET Events and Delegates
#region License
// Copyright 2010 Buu Nguyen, Morten Mertner
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@buunguyen
buunguyen / memoize.bk
Created June 10, 2012 20:29
Memoization in Bike
func memoize(f) {
var cache = {
member_missing: func() { null }
};
return func recur(n) {
cache[n] || (cache[n] = f(recur, n));
};
}
var fib = func(n) {
@buunguyen
buunguyen / phones.bk
Created June 10, 2012 20:29
Find words for phone numbers (Bike version)
#!
Output the combination of strings corresponding to a given phone number.
Only include those strings one of whose substrings must exist in the dictionary.
This script uses the Linux dictionary.
!#
load 'file.bk';
var chars_for = {
'-': ['-'],
@buunguyen
buunguyen / member_missing.bk
Created June 10, 2012 20:23
member_missing in Bike
var obj = {
member_missing: func(name) {
return "Member: {0}".with(name);
}
};
println(obj.notExist); # Member: notExist
println(obj.has_member('notExist')); # False
@buunguyen
buunguyen / ftpsubmitter.cs
Created May 9, 2012 17:39
FTP Submitter for qTrace
namespace FtpSubmitter
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
@buunguyen
buunguyen / phones.py
Created May 5, 2012 04:43
Find words for phone numbers
chars_for = {
'-': ['-'],
'0': ['0'],
'1': ['1'],
'2': ['A', 'B', 'C'],
'3': ['D', 'E', 'F'],
'4': ['G', 'H', 'I'],
'5': ['J', 'K', 'L'],
'6': ['M', 'N', 'O'],
'7': ['P', 'Q', 'R', 'S'],
@buunguyen
buunguyen / circles.html
Created May 5, 2012 04:40
Fun with HTML5 canvas
<!doctype html>
<html lang="en">
<head>
<title>Circles</title>
<meta charset="utf-8" />
<script>
var Point = function(x, y) {
this.x = x;
this.y = y;
}