Skip to content

Instantly share code, notes, and snippets.

View lambda-fairy's full-sized avatar
💜
Hello!

Chris Wong lambda-fairy

💜
Hello!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am lambda-fairy on github.
  • I am lfairy (https://keybase.io/lfairy) on keybase.
  • I have a public key whose fingerprint is 0658 29A6 73B2 9A01 6E68 EC42 4AFA FC07 E9D2 794C

To claim this, I am signing this object:

@lambda-fairy
lambda-fairy / dedup.rs
Last active January 31, 2019 23:22
.dedup() on iterators
use std::iter::Peekable;
trait IteratorDedup: Iterator + Sized {
fn dedup(self) -> Dedup<Self> where Self::Item: PartialEq {
Dedup {
inner: self.peekable(),
emit: true,
}
}
}
@lambda-fairy
lambda-fairy / twilight-1.md
Last active January 11, 2019 20:34
Twilight Sparkle's Magic Spells

Twilight Sparkle's Magic Spells

Twilight Sparkle is researching some magic spells. A spell is a non-empty finite sequence of Apples, Bananas, or Ciwifruit.

Spells can be safe or unsafe. An unsafe spell contains one or more of the following patterns:

Pattern Name
@lambda-fairy
lambda-fairy / textanalyzer.py
Created December 28, 2018 07:23
Report the most common phrases in a text file
#!/usr/bin/env python3
from collections import Counter
from itertools import islice
import re
import string
import sys
MIN_PHRASE_LENGTH = 2
@lambda-fairy
lambda-fairy / kol.js
Created June 26, 2012 06:44
KoL auto-adventure script
javascript:
var frm = window.frames[2];
function next(f) {
setTimeout(f, 100);
}
function doClick(elem) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
elem.dispatchEvent(evt);
}

(Sung to the tune of the Fourmyula song)

Through falling hairs
I pick my way slowly
Farting aloud
Eases my behind

Sunlight filters through

@lambda-fairy
lambda-fairy / summary.json
Created August 11, 2017 09:37
curl https://crates.io/summary | python3 -m json.tool
{
"num_downloads": 196498909,
"num_crates": 10729,
"new_crates": [
{
"id": "gotham_derive",
"name": "gotham_derive",
"updated_at": "2017-08-11T05:40:09Z",
"versions": null,
"keywords": null,
@lambda-fairy
lambda-fairy / 00-setup.md
Last active April 9, 2017 00:55
VPS setup instructions

SSH

  • authorized_keys
  • config
  • lyra and lyra.pub

byobu and fish and GHC

sudo apt update
sudo apt install software-properties-common
@lambda-fairy
lambda-fairy / safecopy_example.rs
Last active March 11, 2017 07:21
Versioned serialization a la safecopy
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate safecopy;
#[safecopy(CrusadersV0 = "0", CrusadersV1 = "1", Crusaders = "2")]
pub struct Crusaders {
apple_bloom: String,
sweetie_belle: String,
@lambda-fairy
lambda-fairy / quotes.md
Created January 10, 2017 05:10
Nice quotes

You can fondle the cube, but it will not respond. -- Warren Buffett

Feelings are boring. Kissing is awesome! -- Ryan North