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 Mathlib.Tactic | |
open Nat | |
theorem induction0 {P : ℕ → Prop} | |
(base : P 0) (step : ∀m, P m → P (succ m)) : (∀n, P n) := by | |
intro k | |
cases k with | |
| zero => exact base | |
| succ m => |
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 math | |
from PIL import Image | |
from PIL import ImageDraw | |
''' | |
to run, need python3 | |
$ python3 -m venv venv | |
$ source ./venv/bin/activate | |
$ pip install pillow |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;; Firefox-like font resizing ;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(define fonts | |
(list->vector | |
(list "5x7" "5x8" "6x9" "6x10" "6x12" "6x13" "7x13" "7x14" "8x13" | |
"8x16" "9x15" "10x20" "11x22" "14x28" "16x32" | |
"-xos4-terminus-medium-r-normal--22-220-72-72-c-110-microsoft-cp1251" |
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
class Line(object): | |
def __init__(self, addr_pattern): | |
self.ins = addr_pattern.split(" ")[0].strip() | |
self.out = addr_pattern.split(" ")[1].strip() | |
def out_format(self): | |
return self.out.replace("x", "0") | |
def matches(self, addr): | |
# addr is a string of 0 and 1 chars. |
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
.power Vdd=1 | |
.thresholds Vol=0 Vil=0.1 Vih=0.9 Voh=1 | |
.group inputs RESET START A[31:0] B[31:0] | |
.group outputs S[31:0] | |
.mode gate | |
.cycle CLK=1 tran 5n assert inputs tran 45n CLK=0 tran 49n sample outputs tran 1n |
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
(defun xscheme () | |
"Loads xscheme and runs a scheme process in the current buffer." | |
(interactive) | |
(load-library "xscheme") | |
(xscheme-start "scheme -emacs" | |
(buffer-name) | |
(buffer-name)) | |
;; | |
) |
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 | |
# simulate the field inside a hollow conductor with N number of | |
# equally space thin wire at a distance R from the center. | |
from PIL import Image | |
from numpy import arange | |
import math | |
#----------------------------------------------------------------------------- |
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
# -*- sh -*- | |
#!/usr/bin/env bash | |
TMPFILE=/tmp/selfcontrol.temp | |
# remove self control from hosts | |
cat /etc/hosts | grep -v self-control > $TMPFILE | |
echo "# self-control" >> $TMPFILE |
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
# translating pseudocode from wikipedia's quicksort to python. | |
# https://en.wikipedia.org/wiki/Quicksort#Lomuto_partition_scheme | |
# algorithm quicksort(A, lo, hi) is | |
def quicksort(A, lo, hi): | |
# if lo < hi then | |
if lo < hi: | |
# p := partition(A, lo, hi) | |
p = partition(A, lo, hi) | |
# quicksort(A, lo, p - 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
#!/usr/bin/env python | |
import sqlite3 | |
import json | |
import argparse | |
parser = argparse.ArgumentParser(description='extract JADE modules from firefox localstorage') | |
parser.add_argument('infile', metavar='infile', | |
type=str, help='the infile, something like: ./some/path/to/webappsstore.sqlite') | |
parser.add_argument('outfile', metavar='outfile', | |
type=str, help='the output, for example myModules.json') |
NewerOlder