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
(import '(javax.swing JFrame JTextField JLabel JOptionPane JPanel JPasswordField) | |
'(java.awt Font Color Graphics2D)) | |
(use 'clojure.contrib.io) | |
(defn exec [session cmd] | |
(let [channel (.openChannel session "exec") | |
reader (reader (.getInputStream channel))] | |
(.setCommand channel cmd) | |
(.connect channel) | |
(let [rv (doall (take-while #(not (nil? %)) (repeatedly #(.readLine reader))))] |
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
(require '[clojure.contrib.string :as s]) | |
(def precedence {"*" 2 | |
"/" 2 | |
"+" 1 | |
"-" 1}) | |
(def ops {"+" + | |
"*" * | |
"-" - |
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
//Changes filter: "conflicts": "function(doc, req) { if(doc._conflicts) { return true; } else { return false; }}" | |
var dbase = 'focus'; | |
var ddoc = 'app'; | |
var sys = require('sys'), | |
couchdb = require('node-couchdb/lib/couchdb'), | |
client = couchdb.createClient(5984, 'crate.im'), | |
db = client.db(dbase), | |
changes = db.changesStream({filter: ddoc + '/conflicts'}); |
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
(ns sector | |
(:require [clj-http.client :as http]) | |
(:use [clojure.contrib.json])) | |
(def couch "http://127.0.0.1:5984/") | |
(def db (str couch "tagged/")) | |
(def view (str db "_design/merge/_view/tags")) | |
;;Just using rqc to record how many rqs are made. | |
(def rqc (agent 0)) |
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
var http = require('http'), | |
httpProxy = require('http-proxy'), | |
url = require('url'); | |
var doproxy = false; //use true if we want to place this in front of another server | |
//could be worth it if we're sitting in front of apache instead of an evented server? | |
var lport = 4881; | |
var rport = 81; | |
var rhost = '127.0.0.1'; | |
var targetuid = 'www-data'; |
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
-module(ticktock). | |
-export([tick/1, tock/1, report/1]). | |
tick(T) -> | |
erlang:put({tick, T}, os:timestamp()). | |
tock(T) -> | |
erlang:put({total, T}, timer:now_diff(os:timestamp(), erlang:get({tick, T})) | |
+ case erlang:get({total, T}) of |
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
f(Vals), f(Mals). | |
Vals = [{insert, iolist_to_binary([<<"test">>, io_lib:format("~6..0B", [X])]), {X, {X, <<1>>}, 0, 0, 5}} || X <- lists:seq(1,20000)]. | |
Mals = [{insert, iolist_to_binary([<<"test">>, io_lib:format("~6..0B", [X*2])]), {X, {X, <<1>>}, 0, 0, 10}} || X <- lists:seq(1,20000)]. | |
f(D), f(F), f(B). | |
couch_server:delete(<<"testdb">>, []). | |
rr(couch_db). | |
{ok,#db{docinfo_by_id_btree = B, fd = F} = D} = couch_server:create(<<"testdb">>, []). | |
f(NB), f(ND). | |
{ok, _, NB} = btree_nif:query_modify_raw_native(D, B, Vals). |
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 coffee | |
Couchstore = require './couchstore' | |
db = new Couchstore 'cstest.couch' | |
create = (cb) -> | |
docset = ((db.newdoc 'doc' + x, {testkey: 'testval' + x}) for x in [1..20]) | |
db.save_multi docset, (err) -> | |
cb?() | |
dump = (fin) -> |
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 coffee | |
fs = require 'fs' | |
program = require 'commander' | |
tpls = { | |
pop: { | |
hdr: "" | |
word: (word) -> | |
""" | |
SET POP, 0x#{word.toString(16)}\n |
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
(ns cloxo.testapp | |
(use [cloxo.instr :only (add-label add-blob add-code save-app)])) | |
(def dprintstr | |
;; We only add to the global namespace when we need to | |
'[^{:label :dprintstr} ^:export | |
(SET B SP) | |
(SET SP A) | |
^{:label :loop} | |
(SET [+ :screen I] POP) |
OlderNewer