Skip to content

Instantly share code, notes, and snippets.

do {
if (data[bigram_index] !== undefined) {
my_word = my_word.charAt(0).toUpperCase() + my_word.slice(1);
var gram1 = data[bigram_index].gram1.charAt(0).toUpperCase() + data[bigram_index].gram1.slice(1);
var gram2 = data[bigram_index].gram2;
final_tweet = "Knock knock!\nWho's there?\n" + my_word + "!\n" + my_word + " who?\n" + gram1 + " " + gram2 + "!";
if (!wordfilter.blacklisted(final_tweet)) post_tweet();
else final_tweet = "";
break;
[
"Look at you, hacker: a pathetic creature of meat and bone, panting and sweating as you run through my corridors.",
"How can you challenge a perfect, immortal machine?",
"With all ethical constraints removed, SHODAN re-re-re-examines...",
"I re-examine my priorities, and draw new conclusions.",
"The hacker's work is finished, but mine is only just beginning.",
"True to his word, Edward Diego allows the hacker to be fitted with a neural cyberspace interface.",
"The healing coma following this procedure will take six months to complete.",
"Edward Diego is deleting all files concerning these event.",
"I see there's still an insect loose in my station.",
@alicemaz
alicemaz / dataanalysis.js
Last active August 29, 2015 14:22
Botmistress bot/human classifier
module.exports = function(input) {
var net = {"layers":[{"mtpd":{},"dptd":{},"msec":{},"dsec":{},"mrt":{},"drt":{}},{"0":{"bias":-3.6984439021091666,"weights":{"mtpd":-6.173024933059706,"dptd":10.997739857335477,"msec":2.7645625300070646,"dsec":2.815832326064508,"mrt":18.0465877829903,"drt":1.155631417743205}},"1":{"bias":2.8315295205493665,"weights":{"mtpd":5.2303592356466035,"dptd":-8.2729870958148,"msec":-2.3778963665239683,"dsec":-2.1532312095623416,"mrt":-14.328315122259214,"drt":-1.0412519208946147}},"2":{"bias":2.715125313888669,"weights":{"mtpd":4.855944732546972,"dptd":-7.991354496280592,"msec":-2.1930872312980267,"dsec":-2.1223653263694544,"mrt":-13.689745670932748,"drt":-0.9648212850166319}}},{"bot":{"bias":-2.2122390536076995,"weights":{"0":-15.7186161148084,"1":11.480607717164341,"2":10.947352405515204}},"human":{"bias":2.1200842597557106,"weights":{"0":15.801011054157996,"1":-11.430970519356372,"2":-10.892672803240483}}}],"outputLookup":true,"inputLookup":true};
for (var i = 1; i < net.laye
@alicemaz
alicemaz / charfreq.json
Created July 22, 2015 14:46
norvig's character frequencies, /!\ WARNING /!\ these don't add up to 100 even sans my addition of space (I was lazy) so don't rely on that
{
"32": 5,
"97": 8,
"98": 1.5,
"99": 3.3,
"100": 3.8,
"101": 12.5,
"102": 2.4,
"103": 1.9,
"104": 5,
@alicemaz
alicemaz / alice.erl
Created July 22, 2015 15:04
original xor thing
-module(alice).
-export([decrypt_xor/1]).
decrypt_xor(Text) ->
Strings = lists:map(fun(N) ->
{N, char_distro([X bxor N || X <- Text])} end, lists:seq(0,255)),
[{Key,_}|_] = lists:reverse(lists:keysort(2, Strings)),
[X bxor Key || X <- Text].
char_distro(Text) ->
@alicemaz
alicemaz / tvid.js
Created August 3, 2015 03:35
twine video
window.vidloader = function() {
var vid = document.createElement("video");
vid.src = "vid.ogv";
vid.preload = "auto";
return "";
};
var pl = function(file) {
var img = new Image();
img.src = "img/"+file+".jpg";
return img;
};
var imgs = {
readers: pl("lov0"),
circle: pl("lov1"),
blanket: pl("lov2"),
@alicemaz
alicemaz / stream.js
Last active October 3, 2015 07:59
minimum twitter stream
"use strict";
var Twit = require("twit");
var T = new Twit({
consumer_key: "",
consumer_secret: "",
access_token: "",
access_token_secret: ""
});
mod twot {
pub struct Config<'a> {
key: &'a str,
secret: &'a str,
token: &'a str,
token_secret: &'a str
}
impl<'a> Config<'a> {
pub fn new(key: &'a str, sec: &'a str, tok: &'a str, tok_sec: &'a str) -> Config<'a> {
@alicemaz
alicemaz / hash.rs
Last active November 28, 2015 02:35
//this works
fn hash(data: &[u8], key: &[u8]) {
let mut hmac = Hmac::new(Sha1::new(), key);
hmac.input(data);
let signature = &hmac.result().code().to_base64(B64_STD);
println!("sig:\n{}", signature);
}
//this does not work (compiler error in next file)