Skip to content

Instantly share code, notes, and snippets.

from copy import deepcopy as copy
LOWERLIMIT = 1
UPPERLIMIT = 10 ** 12
NUMDIGITS = 1
def recur(i):
queue = [[int(j) for j in str(i)]]
z = 0
while z < len(queue):
for j in xrange(len(queue[z]) - 1):
PROMPT 1
TIMEOUT 60
DEFAULT linux
SAY Now booting the kernel from SYSLINUX...
LABEL linux
KERNEL /isolinux/vmlinuz
APPEND toram=squashfs.fs ro
INITRD /isolinux/initrd.img
@jeek
jeek / j4ckcom.py
Created March 17, 2017 11:26
j4ckcom
numbers = [1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 8, 9, 9, 10, 11, 12, 10, 5, 4, 2, 7, 8, 9, 4, 2, 7]
i = 0
while i + 2 < len(numbers):
if numbers[i] < numbers[i+1] and numbers[i+1] < numbers[i+2]:
numbers.pop(i+1)
else:
if numbers[i] > numbers[i+1] and numbers[i+1] > numbers[i+2]:
numbers.pop(i+1)
else:
@jeek
jeek / dedupe.py
Last active June 7, 2016 15:28
Cleaned up code a bit, refactored to only hash where necessary
#!/bin/env python
import os
import hashlib
import argparse
# http://pythoncentral.io/hashing-files-with-python/
def hashfile(afile, hasher, blocksize=65536):
buf = afile.read(blocksize)
@jeek
jeek / inder.go
Last active April 8, 2016 01:35
go attempt
package main
import "fmt"
import "strconv"
import "bytes"
import "math"
// Below from Google examples
/*
@jeek
jeek / easy.py
Last active March 15, 2016 04:02
easy.py
from copy import deepcopy as copy
def recur(i):
queue = [[int(j) for j in str(i)]]
z = 0
while z < len(queue):
for j in xrange(len(queue[z]) - 1):
current = queue[z]
if current[j] != 0:
current = list(queue[z])
from copy import deepcopy as copy
class Memoize:
def __init__(self, f):
self.f = f
self.memo = {}
def __call__(self, *args):
if not args in self.memo:
self.memo[args] = self.f(*args)
return self.memo[args]
@jeek
jeek / Power-Selfies-repeated-with 0-fast.py
Created March 5, 2016 11:05
Power-Selfies-repeated-with 0-fast
from itertools import permutations, combinations
import multiprocessing
def process(z):
numbers = [i for i in str(z)]
thestring = "".join([str(i) for i in numbers])
a = [str(i) for i in numbers]
for b in permutations(thestring):
for c in xrange(0, 2 ** len(numbers)):
answer = ""
@jeek
jeek / nifty2.py
Last active January 28, 2016 00:16
nifty2.py
from copy import deepcopy as copy
queue = []
for i in xrange(1, 10):
for j in copy(queue):
queue.append(j + [i])
queue.append([i])
for i in xrange(1, 10):
for k in queue:
current = " + ".join([str(j) + "**" + str(i) for j in k])
@jeek
jeek / small.py
Last active January 27, 2016 23:54
small.py
queue = [([str(i)],["0"]) for i in xrange(1, 10)]
answers = dict()
while len(queue) > 0:
current = queue.pop()
total = eval("+".join([current[0][i] + "**" + current[1][i] for i in xrange(len(current[0]))]))
if len(current[0]) == 10 and total < 10000:
if total not in answers:
answers[total] = []