Skip to content

Instantly share code, notes, and snippets.

Graham genos

Block or report user

Report or block genos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@genos
genos / # littler - 2017-02-01_11-14-52.txt
Created Feb 1, 2017
littler (homebrew/science/littler) on macOS 10.12.2 - Homebrew build logs
View # littler - 2017-02-01_11-14-52.txt
Homebrew build logs for homebrew/science/littler on macOS 10.12.2
Build date: 2017-02-01 11:14:52
View keybase.md

Keybase proof

I hereby claim:

  • I am genos on github.
  • I am genos (https://keybase.io/genos) on keybase.
  • I have a public key whose fingerprint is 167F 847B C551 05A2 7EF6 C1B9 D398 CA30 9273 6FC3

To claim this, I am signing this object:

@genos
genos / x.py
Created Oct 2, 2013
A Python file to play with a special continued fraction. If you don't have a Python interpreter, try running it in an online one (copy and paste the code), like: http://repl.it/ http://codepad.org/ http://labs.codecademy.com/
View x.py
def x(k):
"""Numerically investigate the continued fraction x =
1 + 1
________________
1 + 1
__________
1 + 1
_____
...
We won't be able to go out to infinity, so we'll use a counter to take only
View craps.lisp
#!/usr/local/bin/sbcl --script
;;;; craps.lisp
;;;;
;;;; My submission to http://programmingpraxis.com/2011/11/04/craps/
;;;; Simulates games of Craps, outputs statistics; REQUIRES SBCL (*posix-argv*)
;;;; GRE, 11/4/11
(defun two-dice ()
"The sum of rolling two dice"
(+ (1+ (random 6)) (1+ (random 6))))
@genos
genos / shamir_threshold_2.c
Created Oct 25, 2011
Shamir Threshold: C (version 2)
View shamir_threshold_2.c
/* shamir_threshold_scheme.c
*
* My C implementation of Shamir's (k, n) Theshold scheme.
* Uses a single flag as opposed to an array; idea from Razvan's great implementation.
* GRE, 6/23/11
*/
#include <stdio.h>
#include <stdlib.h>
#define uint unsigned int
@genos
genos / shamir_threshold.c
Created Oct 25, 2011
Shamir Threshold: C (version 1)
View shamir_threshold.c
/* shamir_threshold_scheme.c
*
* My C implementation of Shamir's (k, n) Theshold scheme.
* GRE, 6/23/11
*/
#include <stdio.h>
#include <stdlib.h>
#define uint unsigned int
#define ulong unsigned long
@genos
genos / shamir_threshold.lisp
Created Oct 25, 2011
Shamir Threshold: Common Lisp
View shamir_threshold.lisp
;;; shamir_threshold_scheme.lisp
;;;
;;; Implements Adi Shamir's (k, n) threshold secret sharing scheme.
;;; GRE, 6/17/11
(defun prod (nums)
"Product of nums"
(reduce #'* nums :initial-value 1))
@genos
genos / shamir_threshold.hs
Created Oct 25, 2011
Shamir Threshold: Haskell
View shamir_threshold.hs
{- shamir_threshold_scheme.hs
-
- My Haskell implementation of Shamir's (k, n) Threshold scheme.
- GRE, 6/23/11
-}
import Data.Bits (shiftR, testBit)
import Data.List (foldl', nub)
import Random (mkStdGen, randomRs)
View list_intersection.scm
;; ORIGINAL QUESTION
; Intersection of two sorted lists
; Output is also a sorted list; takes O(min(m, n)) time, where m = length(list1)
; and n = length(list2).
(define (intersection list1 list2)
(let loop ((l1 list1) (l2 list2) (out '()))
(if (or (null? l1) (null? l2))
(reverse out)
(let ((a (car l1)) (b (car l2)))
(cond ((< a b) (loop (cdr l1) l2 out))
@genos
genos / obfuscated_collatz.c
Created Sep 8, 2011
Obfuscated C code to play with the Collatz Conjecture
View obfuscated_collatz.c
main(int c,char **v){int n=atoi(v[1]);while(n-1){n=n&1?3*n+1:n/2;printf("%d\n",n);}}
You can’t perform that action at this time.