Skip to content

Instantly share code, notes, and snippets.

@jeek
jeek / csr.go
Created October 24, 2015 20:35
csr.go
package main
import (
"bytes"
"container/heap"
"fmt"
"log"
"os"
"strconv"
)
import sys
from copy import deepcopy as copy
from math import log10
from multiprocessing import Pool
from random import shuffle
from time import sleep
from pickle import loads, dumps
from gmpy import is_square
import redis
@jeek
jeek / gist:47b911c006c333382a53
Created October 14, 2015 03:54
Search space of 3.414E118, my ass
3546271 1234657 1374526 5312476 4376152 7642513 7624513
2341567 4653712 6431275 5327416 7365214 3265471 1726453
4256317 6517234 3461752 6745321 7143562 1752346 1234576
7354612 2653471 5137264 3465217 3715246 6423751 2361547
7654213 5143276 4723651 1274365 3416725 1245637 7653241
4723561 3654127 7345126 3254671 3561742 5314267 3257614
1234567 7254631 2637514 5731642 1532467 5467123 7253164
@jeek
jeek / listgen.py
Last active October 10, 2015 10:40
import yaml
import sys
from itertools import permutations
import sqlite3
def gimmealist(cursor, rules={}, exclude=[]):
query = """SELECT (a.a*1000000 + b.a*100000 + c.a*10000 + d.a * 1000 + e.a*100 + f.a * 10 + g.a) AS aa,
(a.b*1000000 + b.b*100000 + c.b*10000 + d.b * 1000 + e.b*100 + f.b * 10 + g.b) AS bb,
(a.c*1000000 + b.c*100000 + c.c*10000 + d.c * 1000 + e.c*100 + f.c * 10 + g.c) AS cc,
(a.d*1000000 + b.d*100000 + c.d*10000 + d.d * 1000 + e.d*100 + f.d * 10 + g.d) AS dd,
@jeek
jeek / halp
Created October 9, 2015 05:32
a11 == 1/2*a14 + 1/2*a23 + a24 + 1/2*a25 + a27 + 1/2*a32 + a34 + 1/2*a36 + a37 + 1/2*a42 + 1/2*a43 + 1/2*a45 + 1/2*a46 + a47 + 1/2*a52 + a54 + 1/2*a56 + a57 + 1/2*a63 + a64 + 1/2*a65 + a67 - a71 + 1/2*a74 - 62222216,
a16 == -a12 - a13 - a14 - a15 - a22 - a23 - a24 - a25 - a27 - a32 - a33 - a34 - a36 - a37 - a42 - a43 - a45 - a46 - a47 - a52 - a54 - a55 - a56 - a57 - a63 - a64 - a65 - a66 - a67 + 2*a71 + 124444432,
a17 == -1/2*a14 + a22 + 1/2*a23 + 1/2*a25 + 1/2*a32 + a33 + 1/2*a36 + 1/2*a42 + 1/2*a43 + 1/2*a45 + 1/2*a46 + 1/2*a52 + a55 + 1/2*a56 + 1/2*a63 + 1/2*a65 + a66 - a71 - 1/2*a74 - 31111108,
a21 == -a12 - a13 - a14 - a15 - 2*a22 - 2*a23 - 2*a24 - 2*a25 - 2*a27 - a32 - a33 - a34 - a37 - a42 - a43 - a45 - a47 - a52 - a54 - a55 - a57 - a63 - a64 - a65 - a67 + 2*a71 + a76 + 124444432,
a26 == a12 + a13 + a14 + a15 + a22 + a23 + a24 + a25 + a27 + a32 + a33 + a34 + a37 + a42 + a43 + a45 + a47 + a52 + a54 + a55 + a57 + a63 + a64 + a65 + a67 - 2*a71 - a76 - 93333324,
a31 == a15 + a25 - a32 - a33 - a34 - a36 - a
@jeek
jeek / magsql.py
Created September 28, 2015 11:46
import sqlite3
from itertools import permutations
GENERATE = False
if __name__ == "__main__":
conn = sqlite3.connect("/tmp/mag.txt")
cursor = conn.cursor()
cursor1 = conn.cursor()
cursor2 = conn.cursor()
@jeek
jeek / mag.py
Created September 28, 2015 03:05
import sys
from itertools import permutations
class Memoize:
def __init__(self, f):
self.f = f
self.memo = {}
def __call__(self, *args):
if not str(args) in self.memo:
self.memo[str(args)] = self.f(*args)
@jeek
jeek / multi.py
Last active April 20, 2016 19:59
from multiprocessing import Pool, Process
from math import log10
from gmpy import is_square
from copy import deepcopy as copy
from sys import argv
import sys
PROCS = 2
FIRSTONE = 1
from itertools import permutations
THELIST = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
LENGTH = 3
for i in permutations(THELIST, LENGTH):
print i
001678f353bf2421e254c2486b346558 ./south/south/south/south/east/east/north/east/east/north/east/east/east/north/east/south/south/east/east/north/north/east/south/east/south/east/east/south/east/south/south/south/south/west/south/west/west/south/west/south/south/west/west/west/south/west/west/south/south/west/west/north/north/west/north/north/image
012259fc706b79a16cf87ff04bc574a5 ./south/south/south/south/east/east/north/east/east/north/east/east/east/north/east/south/south/east/east/north/north/east/south/east/south/east/east/south/east/south/south/south/south/west/south/west/west/south/west/south/south/west/north/image
0255112fa6bae10501b014434cea82ac ./south/south/south/south/east/east/south/image
0361248a2c24377a3ac1a6cd98fd3915 ./south/south/south/south/east/east/north/east/east/north/east/east/east/north/east/south/south/east/east/north/north/east/south/east/south/east/east/south/east/south/south/south/south/west/south/west/west/south/west/south/south/west/west/west/south/west/west/south/east/east/e