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 <stdio.h> | |
#include <limits.h> | |
#include <stdlib.h> | |
int main (int argc, char *argv[]) { | |
char* instr; | |
char outstr[PATH_MAX]; | |
instr = argv[1]; |
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
# remove sendmail from a FreeBSD system | |
echo 'sendmail_enable="NO"' >> /etc/rc.conf | |
chmod 0 /usr/libexec/sendmail/sendmail | |
chmod 0 /usr/sbin/sendmail | |
mv /usr/libexec/sendmail/sendmail /usr/libexec/sendmail/sendmail.bak | |
mv /usr/sbin/sendmail /usr/sbin/sendmail.bak | |
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
;; A T-esque object system in Plan | |
;; Uses new-style let syntax | |
;; wherein (let (x 1 y 2) ...) replaces both (let x 1 ...) and (with (x 1 y 2) ...) | |
(deffn (operation? f) | |
(and (function? f) (= (tag f 'disposition) 'operation))) | |
(deffn (object? o) | |
(and (function? o) (= (tag o 'disposition) 'object))) | |
(w/uniq msg-password |
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
(set spam-words* {}) (tag spam-words* 'default 0) ; todo: implement :->tagged | |
(set good-words* {}) (tag good-words* 'default 0) | |
(deffn (tokens body) | |
(map symbol (regexp-split body /\W+/))) | |
(deffn (bayes &fs) | |
(with (pfs (apply * fs) ifs (map (fn (x) (- 1 x)) fs)) | |
(/ pfs (+ pfs (apply * ifs))))) |
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
; don't use "inverse" because it's not the same as a mathematical inverse | |
; and maybe we'll have a separate system for keeping track of those later. | |
; also possibly set-opposite should be called set-opposite! | |
(let opposites+ {} | |
(deffn (opposite f) (opposites+ f)) | |
(deffn (set-opposite f g) | |
(set (opposites+ f) g))) | |
(defmac (under var (f &s) &body) |
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
;; An implementation of the Mustache template system. (http://mustache.github.com/) | |
;; See http://mustache.github.com/mustache.5.html for the format documentation | |
;; | |
;; Usage: (mustache '{employees ({name "Bob" age "34"} {name "Jim" age "27"} {name "Sally" age "54"})} "{{#employees}}\n* {{name}} is {{age}} years old\n{{/employees}}") | |
;; ==> "\n* Bob is 34 years old\n\n* Jim is 27 years old\n\n* Sally is 54 years old\n" | |
(deffn (mustache-tokens tmpl) | |
(regexp-split (mustache-strip-comments tmpl) r“({{(?:{.+?}|[#&^/>]?.+?)}})”)) | |
(deffn (mustache-strip-comments tmpl) |
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
(set! default-headers* '{content-type "text/html; charset=utf-8" | |
server "Plan httpd"}) | |
;; OHSHI- | |
(set! response-codes* '{100 "Continue" ; 100-199 -- informational | |
101 "Switching Protocols" | |
102 "Processing" | |
200 "OK" ; 200-299 -- success | |
201 "Created" | |
202 "Accepted" |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
# live sparkline display | |
# gems required: ruby-terminfo, getoptions | |
require 'terminfo' | |
require 'getoptions' | |
def bar_height n, min, max | |
h = (((n - min) / (max - min)) * $bs).to_i |
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
Domain name: | |
thesunonsunday.co.uk | |
Registrant: | |
News International Newspapers Limited | |
Registrant type: | |
UK Limited Company, (Company number: 1885543) |
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
#!/usr/bin/ruby | |
require 'fcgi' | |
require 'less' | |
require 'digest/sha1' | |
FCGI.each do |request| | |
out = request.out | |
source = File.new(request.env["SCRIPT_FILENAME"], 'r').read; | |
hash = Digest::SHA1.hexdigest(source).inspect |