This file contains 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
# shortener.rb - Josh Sandlin - 12/5/2010 - 6:19PM | |
# Simple url shortener with Sinatra and OpenKeyVal.org | |
# "THE BEER-WARE LICENSE" (Revision 43): | |
# <joshua.sandlin@gmail.com> wrote this file. As long as you retain this | |
# notice you can do whatever you want with this stuff. If we meet some day, | |
# and you think this stuff is worth it, you can buy me a beer in return. | |
# ~Josh Sandlin | |
require 'rubygems' |
This file contains 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
; pe_7.lisp - Josh Sandlin - 12/28/2010 | |
; Project Euler #7 - 10001st prime | |
; primality predicate function (from PCL ;) | |
(defun primep (number) | |
(when (> number 1) | |
(loop for fac from 2 to (isqrt number) never (zerop (mod number fac))))) | |
; array of primes | |
(defparameter *primes-list* (loop for i from 1 to 150000 |
This file contains 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
(defun euler-totient (n) | |
"Returns the euler-totient, and the coprimes that count the totient | |
for any number n" | |
(let ((coprimes (loop for x from 1 to n when (= 1 (gcd x n)) collect x))) | |
(values (length coprimes) coprimes))) | |
(defun part-k-n (k n) | |
(let ((cache (make-hash-table :test #'equal))) | |
(labels ((aux (k n cache) | |
(multiple-value-bind (val win) (gethash (list k n) cache) |
This file contains 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
#light | |
open System | |
open System.IO | |
open System.Net | |
open System.Net.Sockets | |
open System.Text.RegularExpressions | |
let server = "irc.enigmagroup.org" | |
let port = 6667 |
This file contains 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
#light | |
open System | |
open System.IO | |
let getWordList file = | |
File.ReadAllLines( file ) | |
let rnd = Random() | |
let getRandArrElement arr = |
This file contains 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
// Running on an Arduino Mega2560 R.3 | |
// #20 - SDA | |
// #21 - SCL | |
#include <Wire.h> | |
void setup() { | |
pinMode(13, OUTPUT); | |
Wire.begin(); | |
Serial.begin(9600); |
This file contains 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
/** | |
Two LEDs triggered by tilting of accelerometer | |
along Y axis. | |
Arduino Diecimila and Memsic 2125 | |
*/ | |
int ledPins[] = {6,7}; | |
int yPin = 10; | |
int yRaw; |
This file contains 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
#include <SHT1x.h> | |
#define dataPin 4 | |
#define clockPin 5 | |
SHT1x sht1x(dataPin, clockPin); | |
void setup() { | |
Serial.begin(9600); | |
} |
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <ctype.h> | |
typedef enum {BOOLEAN, FIXNUM, CHARACTER, STRING, THE_EMPTY_LIST, PAIR} object_type; | |
/***************** MODEL ******************/ | |
typedef struct object { |
This file contains 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
#include <Ping.h> | |
Ping ping = Ping(12, 0, 0); | |
boolean is_calibrated = false; | |
float calibration_distance = 0.00; | |
float current_distance = 0.00; | |
int alarm_pin = 13; | |
// because my IO shield is fubar | |
// and has H/L mixed |