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 python3 | |
import json | |
with open('./convert_all.sh') as f: | |
lines = f.readlines()[1:] | |
lines = [line[:-3] if '\\\n' in line else line for line in lines] | |
print(lines) |
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
#lang racket | |
;; Implementation of The Polymorphic Lambda Calculus (AKA System F) in Redex | |
;; No type inference is supported | |
;; Fixed-point combinator is implemented | |
;; Two new terms have been introduced to the calculus, type abstraction and type application | |
;; Useful Functions | |
;; typecheck?, computers the type of a given term, or #f is no type exists | |
;; run, reduces a term to a value | |
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
#lang racket | |
(define (simulate strategy) | |
(define car (random 3)) | |
(define goats (list (modulo (add1 car) 3) | |
(modulo (sub1 car) 3))) | |
(define guess (random 3)) | |
(define reveal (list-ref goats (random 2))) | |
(define final (strategy guess reveal)) | |
(if (= final car) 'win 'lose)) |
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
use std::fs::File; | |
use std::io::Read; | |
use std::mem::{transmute, size_of}; | |
fn get_rand_int() -> u32 { | |
let mut b = [0;4]; | |
let mut f = File::open("/dev/random").expect("Coulnd't open"); | |
f.read(&mut b).expect("Coulnd't read"); | |
unsafe { transmute(b) } | |
} |
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
use std::io::{Read, self}; | |
use std::fs::File; | |
use std::env::args; | |
fn main() -> io::Result<()> { | |
let args : Vec<_> = args().collect(); | |
if args.len() != 3 { panic!("Invalid Args!") } | |
let filename = &args[1]; | |
let syscall = &args[2]; | |
let syscall_int : u8 = match syscall.parse() { |
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
#lang racket | |
;; Usage information | |
;; Clone "https://github.com/papers-we-love/papers-we-love" | |
;; Use the download script under "scripts" | |
;; Create a file called "interests.txt" containing a list of | |
;; topics that you are interested in | |
;; Fill in the variable pdf-viewer with the path to your | |
;; pdf application (or #f if you don't want it to automatically oepn |
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
#lang racket | |
(require threading) | |
(module+ test | |
(require rackunit)) | |
;; Parsing | |
(define src | |
(~> | |
(with-input-from-file "total_input" | |
(lambda () (port->lines (current-input-port)))) |
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
#lang racket | |
(require threading) | |
(define (parse-line line) | |
(match (string-split line " ") | |
[(list dir amnt) | |
(cons (parse-dir dir) (parse-amnt amnt))])) |
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
#lang racket | |
(require threading) | |
(require data/bit-vector) | |
(define src | |
(~> | |
(with-input-from-file | |
"/tmp/input" | |
(λ () (port->lines (current-input-port)))) | |
(map string->list _))) |
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
#lang racket | |
(require threading) | |
(require "parser.rkt") | |
(module+ test (require rackunit)) | |
(define winnings '()) | |
(define src | |
(syntax->datum | |
(with-input-from-file "/tmp/input" |