Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Jenkins markjenkins

View GitHub Profile
@markjenkins
markjenkins / recording_pipeline.sh
Created May 13, 2015
Record an mp3 stream into 2 hour blocks
View recording_pipeline.sh
#/bin/sh
while true; do \
wget -q -O - http://livehq.umfm.com/ | \
cronolog -H /home/mark/archives/current.mp3 \
-p "2 hours" '/home/mark/archives/%Y-%m-%d/%s.mp3'
sleep 1s
done
@markjenkins
markjenkins / custom_crack_multibit_key_export.py
Last active Mar 15, 2016
Custom program for cracking a multibit .key backup file (compatible with openssl enc/dec) with some existing knowledge of a passphrase I was told by someone who forgot some of it.
View custom_crack_multibit_key_export.py
#!/usr/bin/env python
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
# http://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html
# @author Mark Jenkins <mark@markjenkins.ca>
# usage
View src_gametree_node.py
PRED_VAL, PRED_DEPTH = range(2)
# abreviated version of FEN, we don't include the en-pessant unless available
# as for clock times, we're keeping the lowest seen per state, not making
# it unique
START_STATE = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq'
def pawn_move_or_capture(first_state, second_state):
"""determine if the transition from first_state to second_state entailed
a pawn capture
@markjenkins
markjenkins / fibonacci_reduce.py
Created Mar 15, 2016
iterative, functional definition of the fibonacci sequence using reduce()
View fibonacci_reduce.py
#!/usr/bin/evn python
# An iterative, functional definition of the fibonacci sequence using reduce()
# This is how I originally wrote this.
# map is going to be removed from the builtin namespace. So the newer
# version below doesn't use them.
#
# Advocates for removing lambda would consider this to be a good example
# of why it should be removed.
View Makefile
# Makefile
ZONE_LIST=zone_list_file
ZONE_FILE_SUFFIX=".db"
all: zone_list.zones internal_zone_list.zones
zone_list.zones: $(ZONE_LIST) Makefile
./make_zone_list --prefix "/etc/bind/" \
--suffix $(ZONE_FILE_SUFFIX) $^ > $@
@markjenkins
markjenkins / simple_arith.py
Created Mar 15, 2016
simple arithmetic expression parser
View simple_arith.py
from pyparsing import Word, alphas, oneOf, operatorPrecedence, opAssoc
operand = Word(alphas)
signop = oneOf('+ -')
multop = oneOf('* /')
plusop = oneOf('+ -')
ARITH_EXPR = operatorPrecedence( operand,
[(signop, 1, opAssoc.RIGHT),
@markjenkins
markjenkins / account.py
Last active Mar 22, 2016
ripple-validator-hognose
View account.py
from .base58 import ripple_base58_decode, ripple_base58_encode
from .util import binary_encode_variable_data
from .crypto import double_sha256_checksum
ACCOUNT_NUM_BITS = 160
ACCOUNT_NUM_BYTES = 20
def extract_checksum(account_msg):
return account_msg[-4:]
@markjenkins
markjenkins / constants.py
Created Mar 22, 2016
peanut chess engine
View constants.py
BOARD_SIZE = 8
FIRST_RANK = 1
LAST_RANK = BOARD_SIZE
PAWN_START = 2
KING_START_FILE = 5
KNIGHT, KING, BISHOP, ROOK, QUEEN, PAWN = (
'N', 'K', 'B', 'R', 'Q', 'P'
View update_glicko2_csv.py
#!/usr/bin/env python
# coding=UTF8
"""
Copyright (c) 2014 Rudolf Rocker Chess Club
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
View first_querry_by_ip.py
from sys import argv
# tab separated input from processing apache logs with awk to just have relevant fields and tab separation
ips = set()
with file(argv[1]) as f:
for line in f:
ip, date, url = line.split('\t')
if ip not in ips:
print "%s\t%s" % (ip, date)
You can’t perform that action at this time.