Skip to content

Instantly share code, notes, and snippets.

View aleks-mariusz's full-sized avatar

aleks mariusz aleks-mariusz

  • Cambridge, UK (formerly, London, UK, and NYC)
  • 17:57 (UTC +01:00)
View GitHub Profile
@aleks-mariusz
aleks-mariusz / osmaps-mobac.py
Last active March 18, 2017 18:04
this will download the geojson for ordinance survey's maps, parse it and create mobac-profiles for their explorer/landranger series of maps
#!/usr/bin/env python
import argparse
import itertools
import json
import math
import os
import re
import sys
import urllib2
@aleks-mariusz
aleks-mariusz / XL_list_of_BNGs
Last active May 15, 2021 09:15
script to download the Ordnance Survey tiles from streetmap.co.uk (not related to OpenStreetMaps) specifically the Explorer (1:25000) and LandRanger (1:50000) maps, takes as an argument a .tfw or .tab (tarball included) for a segment. See https://upload.wikimedia.org/wikipedia/commons/f/f5/Ordnance_Survey_National_Grid.svg for info about the gri…
HP40NE
HP40SE
HP50NE
HP50NW
HP50SE
HP50SW
HP51NE
HP51SE
HP60NE
HP60NW
@aleks-mariusz
aleks-mariusz / safari-open-pages.py
Created August 24, 2014 16:35
This script fetches the current open tabs in all Safari windows. Useful to run remotely on your mac when you are at work and want to read a page you have open (remotely) at home but don't remember the url but can log in to your home system on the command line
#!/usr/bin/python
#
# This script fetches the current open tabs in all Safari windows.
# Useful to run remotely on your mac when you are at work and want
# to read a page you have open (remotely) at home but don't remember
# the url but can log in to your home system on the cmmand line
#
import sys
@aleks-mariusz
aleks-mariusz / _ubsig-dump.py
Last active August 29, 2015 14:00
April 28th 2014 - My latest dabbling with trading (been into it for over 10 years) has been with binary options. They aren't as fancy or sexy as usual equity derivatives though, and more akin to placing wagers on the fixed-time outcome (so all-or-nothing results). I found a free demo site that provides trading-signals and reverse engineered the …
#!/usr/bin/env python
#
# emulates a web browser for the purpose of harvesting and dump trade data/signals being sent via socketio
#
# version 1.3.1 - fixed an issue with the inverse time.mktime assuming localtime instead of gmtime (need calendar.gmtime instead)
# version 1.3 - added signal handling for HUP requesting csv files be flushed to disk (since we do i/o buffering by default)
# version 1.2 - updated code to be python 2.6 friendly (i need to tell my friend to up update his server already)
# version 1.1 - various improvements for more robust exception handling/socket restarting
# version 1.0 - initial entry
@aleks-mariusz
aleks-mariusz / bin-rhel_patch_sync.py
Created May 1, 2014 05:33
Nov 10 2012 - I had a bit of downtime after Sandy struck NYC and our office was shut down for 6 weeks (yay for being located within a few hundred yards of the ocean and parking lots turning into pools with cars bobbing like apples). So while i was working from home, i finally found some time to work on something i was asked to do a few months ba…
#!/ms/dist/python/PROJ/core/2.7.3/bin/python
REMOTE_REPO_TYPE = 'RHEL'
LOCAL_REPO_DIR = '/var/tmp/rhel'
PROXY_PARAMETERS = { 'https': 'wwwproxy:8080' }
import os
import sys
from os.path import abspath, dirname, normpath
@aleks-mariusz
aleks-mariusz / itunes-compact.py
Created May 1, 2014 05:25
Oct 22 2012 - I've been collecting mp3's since '96 but they now live in a huge (30k song) iTunes library. Problem is, the 'date added' field is not-modifyable to sync the field to the file-system timestamps i saved (at least not directly via the itunes app), so i needed a way to edit the field in the back-end raw/binary library database. Fortuna…
#!/usr/bin/env python
from __future__ import print_function
from io import FileIO
import os
import sys
import zlib
import struct
import argparse
@aleks-mariusz
aleks-mariusz / ibm-sn-lookup.py
Created May 1, 2014 05:22
Oct 3 2011 - We had a number of issues on some flaky components from a vendor and needed a way to query the FRU identification code of the parts. Fortunately given a system's serial number, there was a public web page to query it (but no real API to use), so i wrote this utility to query the components of a system given its part number and model…
#!/ms/dist/python/PROJ/core/2.7.1/bin/python
import re
import sys
import urllib
import urllib2
import argparse
import cookielib
import ms.version
@aleks-mariusz
aleks-mariusz / hp_sl_power_monitor2.py
Last active August 29, 2015 14:00
Oct 20 2011 - as part of work for management of a 20k node cluster, i needed a way to ascertain power utilization. i was able to reverse engineer the protocol used by a vendor-provided utility that can extract power usage (but the vendor wouldn't release the details of their API), so i created this system of real-time power monitoring of systems…
#!/ms/dist/python/PROJ/core/2.7.1/bin/python
import os
import sys
import time
from shutil import move, copy
import ms.version
@aleks-mariusz
aleks-mariusz / tcpdumpDecode.pl
Created May 1, 2014 05:13
Apr 20 2012 - who doesn't love the ubiquitous tcpdump.. widely available and semi-straight forward to use. but when you want to dump packets and don't dream in hex, it's nice to be able to see the stream of data coming over the wire 'live'. so i wrote an quick adapter script to convert the hex-editor output (from tcpdump -nlXs 1500) into actual …
#!/usr/bin/perl
$| = 1;
use strict;
while (<>) {
chomp;
my ($offset,$addr,$hex) = /^\s*(0x([0-9a-f]+):?)\s+((\s[0-9a-f]{2,4}){1,8})/;
@aleks-mariusz
aleks-mariusz / minerd.py
Created May 1, 2014 05:11
June 1 2011 - I started learning python after hearing some good things about it spring of 2011 and needed some simple projects to get my feet wet. Then after the gawker article made bitcoins famous, i decided to try my hand at mining some. but cpu-mining is so inefficient you need a ton of resources to do it. how does one manage a mining system …
#!/ms/dist/python/PROJ/core/2.7.1/bin/python
import os
import sys
import time
import signal
import shutil
from time import time, sleep
from tempfile import mkdtemp
from subprocess import Popen, PIPE