Skip to content

Instantly share code, notes, and snippets.

@matthewfl
matthewfl / chat.index.html
Created November 24, 2010 06:22
A really basic chat server on http://chat.jsapp.us
<html>
<head>
<title>Chat</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
$(function () {
function check () {
$("#output").load('/update', function () {
setTimeout(check, 1);
});
import urllib
import re
import os
path = "./"
i = 1
content = True
while content:
dir = os.listdir(path)
for file in dir:
function BF (code, get, print) {
eval("var i=0,d={0:0};"+code.replace(/[^\[\]\-\+\,\.\<\>]/g, "").replace(/\]/g, "}").replace(/\[/g, "while(d[i]) {").replace(/\-/g, "d[i]--;").replace(/\+/g, "d[i]++;").replace(/\</g, "i--;d[i]=d[i]?d[i]:0;").replace(/\>/g, "i++;d[i]=d[i]?d[i]:0;").replace(/\,/g, "d[i]=get();").replace(/\./g, "print(d[i]);"));
}
faster(X,Y) :- faster(X,Z), faster(Z,Y).
eat(X,Y) :- faster(X,Y), carnivore(X).
eat(lion, zebra).
faster(zebra, dog).
carnivore(dog).
% then I try
eat(lion, X). % and I only get zebra
// the time between bits about 9600 bauds
#define bitDelay 101
void printByte(char out) {
digitalWrite(7, HIGH); // start bit
delayMicroseconds(bitDelay);
for(char mask=0x01; mask; mask <<=1) {
digitalWrite(7, out & mask ? HIGH : LOW); // I am not sure which way this should go
delayMicroseconds(bitDelay);
# make a little code system using a lot of dir
sub makeMess {
my $dep = shift;
if ($dep != 0) {
for(my $c=0; $c<10; $c++) {
mkdir("$c");
chdir("$c");
makeMess($dep-1);
chdir("..");
// http://www.xs4all.nl/~weegen/eelis/analogliterals.xhtml
#ifndef ANALOGLITERALS_HPP
#define ANALOGLITERALS_HPP
namespace analog_literals {
typedef unsigned int uint;
// Symbols
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
__doc__ = """Tiny HTTP Proxy.
This module implements GET, HEAD, POST, PUT and DELETE methods
on BaseHTTPServer, and behaves as an HTTP proxy. The CONNECT
method is also implemented experimentally, but has not been
tested yet.
@matthewfl
matthewfl / linux vex loader
Created September 27, 2009 07:38
vex linux build file
#!/bin/bash
files=( main ) # should be file name without suffix, suffix should be .c
target="program"
setting="-D_VEX_BOARD"
if [ -z $1 ]
then
echo "$0 [build | download | clean]"
@matthewfl
matthewfl / x
Created June 7, 2009 02:08
Domainr domain name lookup
function query (domain, obj) {
var url = "http://domai.nr/api/json/search?q="+domain
jQuery.get(url, null, function (j) {
j = Utils.decodeJson(j);
var text = "";
for(var a =0;a< j.results.length;a++) {
text += "<p style='color:";
text += j.results[a].availability == "taken" ? "red" : "green";
text += "'>";
text += j.results[a].domain + j.results[a].path;