Skip to content

Instantly share code, notes, and snippets.

@Transfusion
Transfusion / keybase.md
Created May 28, 2014 11:36
Anti-surveillance precaution

Keybase proof

I hereby claim:

  • I am transfusion on github.
  • I am transfusion (https://keybase.io/transfusion) on keybase.
  • I have a public key whose fingerprint is 57A1 E6E0 73AD 1F7A B177 1563 F5A9 9B36 38DA 0B00

To claim this, I am signing this object:

Awk

17 characters

/42/{print"SIGN"}

Bash

/42/{print"SIGN"}
@Transfusion
Transfusion / pg63_44_AE1MFC_bryan_kok
Last active August 29, 2015 14:07
pg63_44_AE1MFC_bryan_kok
proof
# Comments like these represent my informal thoughts...
1 p => q Hypothesis % ok
2 r | s Hypothesis % ok
3 ~s => ~t Hypothesis % ok
4 ~q | s Hypothesis % ok
5 ~s Hypothesis % ok
6 ~p & r => u Hypothesis % ok
7 w | t Hypothesis % ok
@Transfusion
Transfusion / pg63_43_AE1MFC_bryan_kok
Created October 14, 2014 14:05
pg63_43_AE1MFC_bryan_kok
proof
# Comments like these represent my informal thoughts...
1 ~p => r & ~s Hypothesis % ok
2 t => s Hypothesis % ok
3 u => ~p Hypothesis % ok
4 ~w Hypothesis % ok
5 u | w Hypothesis % ok
# From lines d and e, u | w and ~w implies u.
@Transfusion
Transfusion / pg63_42_AE1MFC_bryan_kok
Created October 14, 2014 14:10
pg63_42_AE1MFC_bryan_kok
proof
# Comments like these represent my informal thoughts...
1 p | q Hypothesis % ok
2 q => r Hypothesis % ok
3 p & s => t Hypothesis % ok
4 ~r Hypothesis % ok
5 ~q => u & s Hypothesis % ok
# Using modus tollens on lines 2 and 4.
@Transfusion
Transfusion / mergesort_in_c.c
Created October 19, 2014 03:18
mergesort_in_c
#include <stdio.h>
#include <stdlib.h>
void mergeSortedLists(int a[], int b[], int c[], int sizeofa, int sizeofb){
//int sizeofa = sizeof(a)/sizeof(int);
int indexa = 0, indexb = 0, indexc = 0;
//int sizeofb = sizeof(b)/sizeof(int);
int sizeofc = sizeofa + sizeofb;
printf("%d\n", sizeofc);
while (indexa < sizeofa && indexb < sizeofb){
if(a[indexa] < b[indexb]){
@Transfusion
Transfusion / associativity_of_biconditional_bryan_kok
Last active August 29, 2015 14:07
associativity_of_biconditional_bryan_kok
proof
1 (p <=> q) <=> r Hypothesis % ok
2 (p <=> q) => r AndEL 1 % ok
3 r => (p <=> q) AndER 1 % ok
4 [ p Assumption % ok
5 [ r Assumption % ok
6 p <=> q ImpE 3,5 % ok
7 p => q AndEL 6 % ok
8 q ] ImpE 7,4 % ok
@Transfusion
Transfusion / ghci_showInt_comparison
Created January 31, 2015 04:58
Performance comparison in GHCi of various showInt implementations
$ ghci final2.hs
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( final2.hs, interpreted )
Ok, modules loaded: Main.
*Main> :set +s
*Main> (showInt $ product [1..80000]) !! 476674
'0'
@Transfusion
Transfusion / final2.hs
Created January 31, 2015 05:02
showInt with fold, attempted tail recursion and normal recursion.
import Data.List
showInt :: Integer -> String
showInt number =
let tostr = show number
in let digitcount = length tostr
in let b = zip tostr [digitcount, digitcount-1 ..1]
in foldr (\x y ->
if snd x `mod` 3 == 0 && snd x /= digitcount
then " "++[fst x]++y