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
let drop = https://prelude.dhall-lang.org/List/drop | |
let generate = https://prelude.dhall-lang.org/List/generate | |
let f = \(g : Natural) -> generate g Natural (\(x : Natural) -> x) | |
in \(g : Natural) -> \(n : Natural) -> drop n Natural (f g) |
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
enum_discrim_align_threshold = 70 | |
error_on_line_overflow = true | |
error_on_unformatted = true | |
format_code_in_doc_comments = true | |
format_macro_matchers = true | |
format_strings = true | |
imports_layout = "HorizontalVertical" | |
match_block_trailing_comma = true | |
max_width = 80 | |
imports_granularity = "Module" |
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 sh | |
alias isodate='date +"%Y-%m-%d"' | |
if [ $# -eq 0 ]; then | |
cat ~/todo/$(isodate).txt | |
exit 0 | |
fi | |
if [ $# -gt 1 ]; then |
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 Data.List | |
mean x = (sum x) / (fromIntegral $ length x) | |
med xs = med' $ sort xs | |
med' [x] = x | |
med' [x, y] = (x + y) / 2 | |
med' xs = med' $ drop 1 $ take (length xs - 1) xs |
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
/// Ring buffer of utf8 strings | |
struct RingBuf { | |
ptr : *mut u8, | |
start : usize, | |
len : usize, | |
cap : usize, | |
} | |
impl RingBuf { |
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 node | |
const pegjs = require("pegjs"); | |
const fs = require("fs"); | |
const file = fs.readFileSync(process.argv[2], "utf-8"); | |
const parser = pegjs.generate(file); | |
const input = fs.readFileSync(0, "utf-8"); | |
console.log(parser.parse(input)); |
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
#![allow(unused_imports)] | |
#![allow(unused_variables)] | |
#![allow(dead_code)] | |
#![allow(unused_mut)] | |
use std::cmp::{Ord, Ordering}; | |
use std::collections::HashMap; | |
use std::convert::TryFrom; | |
use std::fmt; |
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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"os" | |
"regexp" | |
) |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
geohash := "u4pruydqqvj" | |
for i := range geohash { | |
fmt.Println(geohash[:i+1], "\t", geohash2bits(geohash[:i+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
// The executor part was directly copied from the async book | |
// the http handler trait was written through trial and error | |
// and reading documentation | |
// | |
// Thre's two different handlers that I wrote, which behave the | |
// same way. The difference is that one is written with the | |
// async_trait macro and the other is hand written. | |
// | |
// The handlers pretty much look like the example code, in async_trait | |
// but the error message when the lifetime parameter on w and r were |
NewerOlder