This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Actual recipient and sender are defined in another file | |
script_dir=`dirname $0`; | |
script_name=`basename $0`; | |
config_file="$script_dir/config-$script_name"; | |
if [ -f $config_file ]; then | |
source $config_file; | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> var sb = new ServiceBox(); | |
> sb.msg = "Hello World"; | |
> var handler = sb.wrap(function (prefix) { | |
... console.log(prefix); | |
... console.log(this.msg); | |
... }); | |
> handler("this is the prefix"); | |
this is the prefix | |
Hello World |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _COMMON_H_ | |
#define _COMMON_H_ | |
#define SEM_KEY_FILE ("sem.key") | |
#endif /* _COMMON_H_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.aspyct.going; | |
import java.util.Iterator; | |
import java.util.Stack; | |
/** | |
* This is an implementation of the Left Leaning Red/Black Tree as | |
* described in the course from the University of Princeton. | |
* | |
* This code contains a lot of assertions (assert ;). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: display-double.cpp | |
* Author: aspyct | |
* | |
* Can be compiled to a binaly that displays the binary value of double numbers. | |
* Usage : ./a.out <number1> ... <number n> | |
* Example: ./a.out 1.0 2.5 | |
* | |
* Created on July 28, 2012, 11:03 PM | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define("true ", false); | |
function doIt() { | |
define(" false", true); | |
define("maybe", rand() & 1); | |
} | |
function ($stupid="clever") { | |
if (assert_value($stupid)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Heap | |
def initialize | |
# @elements is an array representing the tree | |
# for each i: | |
# parent => @elements[i / 2] | |
# left => @elements[i * 2] | |
# right => @elements[i * 2 + 1] | |
@elements = [] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample implementation of quicksort and mergesort in ruby | |
# Both algorithm sort in O(n * lg(n)) time | |
# Quicksort works inplace, where mergesort works in a new array | |
def quicksort(array, from=0, to=nil) | |
if to == nil | |
# Sort the whole array, by default | |
to = array.count - 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* More info? | |
* [email protected] | |
* http://aspyct.org | |
* | |
* Hope it helps :) | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add these permissions to your android manifest --> | |
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | |
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> |
OlderNewer