Skip to content

Instantly share code, notes, and snippets.

View lukechampine's full-sized avatar

Luke Champine lukechampine

View GitHub Profile

how to into git (and GitHub)

This is a handy reference for setting up and using git to contribute to projects on GitHub. It is by no means a complete guide to using git; use http://gitref.org for that.

Update: This site provides some excellent visualizations of what various git commands do. Highly recommended.

basics

setup

First run the following commands, using your real name and GitHub email address:

@lukechampine
lukechampine / a.c
Created October 19, 2014 01:00
a.c (with a.h expanded)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/mman.h>
typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L;
#define O printf
#define R return
#define I(a...) if(a)
#define W(a...) while(a)
@lukechampine
lukechampine / Y Combinator in Haskell.md
Last active May 20, 2024 14:56
Deriving the Y Combinator in Haskell

The Y Combinator

The Y Combinator is a classic lambda calculus construct that many people find baffling. Here's my attempt to explain it as clearly as possible (no promises!). Familiarity with Haskell syntax is assumed.

The problem we're trying to solve is how to write an anonymous function (a "lambda") that is recursive. Normally, if you want to write a recursive function, it looks like this:

fac n = if n == 0 then 1
        else n * fac (n-1)

Keybase proof

I hereby claim:

  • I am lukechampine on github.
  • I am lukechampine (https://keybase.io/lukechampine) on keybase.
  • I have a public key whose fingerprint is 99C2 18A7 FA3C C119 562B D6C5 A5C1 CE07 4CBF 1D60

To claim this, I am signing this object:

@lukechampine
lukechampine / explore.go
Created April 4, 2017 20:09
Helper for exploring patterns in the Sia blockchain
package main
import (
"encoding/json"
"io/ioutil"
"log"
"os"
"github.com/NebulousLabs/Sia/encoding"
"github.com/NebulousLabs/Sia/persist"
[alias]
au = add -u .
c = commit -m
ca = commit --amend
can = commit --amend --no-edit
cf = commit --fixup
co = checkout
cob = checkout -b
com = checkout master
cp = cherry-pick
@lukechampine
lukechampine / cold.go
Created October 4, 2017 16:05
Cold wallet address generator
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"github.com/NebulousLabs/Sia/crypto"
@lukechampine
lukechampine / fuzzseed.go
Created January 31, 2018 00:34
Find the one word missing from a seed
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
"github.com/NebulousLabs/Sia/modules"
@lukechampine
lukechampine / monads.c
Last active September 22, 2024 12:33
Maybe and Either Monads in C
#include <stdio.h>
#include <stdbool.h>
// Maybe
typedef struct MaybeInt {
int just;
bool nothing;
} MaybeInt;
# ssh config to connect to a host via local network if available.
#
# For example, if the host is 192.168.1.10 on your local network,
# first run ssh-keyscan 192.168.1.10 to see what keys are available,
# then substitute that key for your_host_key (-t selects the key type).
Match exec "ssh-keyscan -T 1 -t ed25519 local.ip.for.host 2>/dev/null | grep -F your_host_key" host yourhostname
Hostname local.ip.for.host
Port 22