Skip to content

Instantly share code, notes, and snippets.

@danmux
danmux / vbmap_test.go
Created June 3, 2015 10:39
Couchbase work out a set of keys that are guaranteed to write to all vBuckets
// from github.com/go-couchbase
// Copyright (c) 2013 Couchbase, Inc.
//
package couchbase
import (
"fmt"
"testing"
"unsafe"
)
@danmux
danmux / iosDateParse.js
Created June 12, 2011 16:58
parsing date string into a date object on iOs
// iOs or mobile webkit hacking
var syncdate = null;
if(model.synchdate) {
var arr = model.synchdate.split(/[- :T]/);
syncdate = new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]);
}
@danmux
danmux / fmfm.java
Created November 24, 2015 00:50
fmemo
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.lang.*;
public class DSAP2 {
// public class res {
// public List tree = new ArrayList();
// }
import java.util.*;
class Temp {
public static void main(String[] args) {
// this works....
ArrayList<ArrayList<String>> outer = new ArrayList<ArrayList<String>>();
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.lang.*;
public class DSAP3 {
ArrayList<ArrayList<Integer>> data = new ArrayList<ArrayList<Integer>>();
@danmux
danmux / oneif.asm
Last active December 17, 2015 22:32
// single if statement
a := 4 // MOVIR R0, 4 --
// RTOI R1, R0 -- R1 = local integer variable int
if a == 5 {
// SUBI R2,R1,5 -- subtract 5 from R1 and store result in R2
Dan: and the only algo we have for creating tokens right now is sha256 :)
Leonardo: is good enough :-)
Dan: source value is sha256 from rand ...... "On Unix-like systems, Reader reads from /dev/urandom. On Windows systems, Reader uses the CryptGenRandom API."
Leonardo: I do not tust that
Dan: yes
Leonardo: I always have a USB connected sensor to fetch quantum noise
Dan: yes we may wan to consider that kind of thing at some point - not sure how collisiony it is
# the fasd thing
eval "$(fasd --init auto)"
# helps hide some prompt cruft in zsh
export DEFAULT_USER=dan.mullineux
makeNewBranch() {
git branch $1
git checkout $1
git push -u origin $1
package iban
import "testing"
func TestParse(t *testing.T) {
// Valid IBAN
iban, err := Parse("DE10123")
if err != nil {
t.Error(err.Error())
}