Skip to content

Instantly share code, notes, and snippets.

View remexre's full-sized avatar

Nathan Ringo remexre

View GitHub Profile
@remexre
remexre / peano.py
Created June 15, 2014 07:24
Simple Arithmetic Functions from the Peano Axioms
#!/usr/bin/env python3
def S(x): # O(1)
"""Successor function.
Simply put, S(x) = x + 1."""
return x+1
def iS(y): # O(y)
"""Inverse of the successor function.
#include <cstdio>
#include <set>
#include <gmpxx.h>
int main(int argc, char** argv) {
// Set upper bound
mpz_class max;
{
unsigned int maxpow2 = 8;

Keybase proof

I hereby claim:

  • I am tikiking1 on github.
  • I am tikiking1 (https://keybase.io/tikiking1) on keybase.
  • I have a public key whose fingerprint is F13A 40A8 C0CE 5BDE 508B B2BC B834 3229 D7BB D7D7

To claim this, I am signing this object:

@remexre
remexre / Minesweeper.java
Created October 9, 2013 18:48
Minesweeper
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Random;
import javax.imageio.ImageIO;

Keybase proof

I hereby claim:

  • I am remexre on github.
  • I am remexre (https://keybase.io/remexre) on keybase.
  • I have a public key ASArS9ZXSTjnMwThG6No6iTC2K2CVK_Ww6kEDogqNUlavAo

To claim this, I am signing this object:

@remexre
remexre / .gitconfig
Last active September 9, 2016 19:24
Dotfiles
[alias]
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
[push]
default = simple
[user]
email = remexre@gmail.com
name = Nathaniel Ringo
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
extern crate ocl;
use ocl::*;
macro_rules! test {
($obj: expr, $func: ident) => {
println!(concat!("\t", stringify!($obj), ".", stringify!($func), "(): {:?}"),
$obj.$func().chars().last() == Some('\0'));
};
($prefix: expr, $obj: expr, $func: ident) => {
extern crate ocl;
extern crate raw_cpuid;
extern crate serde;
extern crate serde_json;
include!(concat!(env!("OUT_DIR"), "/serde_types.rs"));
fn main() {
let cpu_vendor_name = format!("{}", raw_cpuid::CpuId::new().get_vendor_info().unwrap());
let plats = ocl::Platform::list();
;; C-like
(defn int foo (int x str y)
...)
;; Rust-like
(defn foo:int (x:int y:str)
...)
;; CLOS-like
(defn (foo int) ((x int) (y str))
;; POSIX-based API. Really long and yuck.
(defn capitalize-file (path)
; Read the input.
(def in-fd (open path))
(def in-str (read in-fd))
(close in-fd)
; Process the input.
(def out-str (toupper in-str))
; Write the output.
(def out-fd (open path 'w))