Skip to content

Instantly share code, notes, and snippets.

@andrewbolster
andrewbolster / imgurlinker.py
Created April 2, 2015 13:47
imgur arbitrary URL parser and decomposer
import urllib2
from time import sleep
from imgurpython import ImgurClient
from imgurpython.helpers.error import ImgurClientError, ImgurClientRateLimitError
def imgurlinker(x):
global client
try:
defrag = urllib2.urlparse.urldefrag(x)[0] # To deal with post-url items eg "#0"
-24/1/10-
Chrome(Unstable)
Dropbox
Launchy
CCleaner
Bamboo Driver
DisplayLink (Lilliput) Driver
VLC
[REMOVED GADGET FEATURE]
Virtual Clone Drive
@andrewbolster
andrewbolster / speedie.py
Created August 6, 2012 15:00
How to make speed
# Array evaluations were taking up 60% of my execution time. This is a simplified version
import logging, numpy
logging.basicConfig(level=logging.INFO)
x=numpy.random.rand(100,100)
logging.debug("This is bloody slow because of this: %s"%x)
# Remember, the array is evaluated BEFORE being passed to logging
@andrewbolster
andrewbolster / spoitfy error log
Created May 18, 2015 14:57
Spotify error log after having cleared .cache/spotify directory
bolster@yossarian ~/.cache
➜ spotify 5779-[14:36:24]
13:36:27.454 I [breakpad.cpp:110 ] Registered Breakpad for product: spotify
13:36:27.455 I [translate.cpp:152 ] Reloading language file
13:36:27.465 I [translate.cpp:152 ] Reloading language file
13:36:27.466 I [breakpad.cpp:269 ] Searching for crashdumps: /home/bolster/.cache/spotify/*.dmp
13:36:31.617 I [offline_authorizer.cpp:278 ] Unable to login offline: no such user
13:36:36.722 I [ap_connection_impl.cpp:901 ] Connecting to AP lon2-accesspoint-a33.ap.spotify.com:4070
A Message from Farset Labs:
Hand-in Procedure
The hand-in procedure has two (2!) deadlines, is simple to follow, and can be handled by a single member of each team.
Hand-in Deadlines (all local times)
@andrewbolster
andrewbolster / Aliases
Created February 5, 2013 10:06
Handy Dandy Aliases
# Take the last command and try it again with sudo while deleting leading spaces
alias please='sudo $(history 2 | head -n1 | perl -pe "s/^\s*\d+\s+//")
# Python compilation check without execution (parse without exec)
alias pycheck='python -m py_compile'
# Python profiling
alias pryfile='python -m cProfile -o profile.run'
# Enhanced Sudo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewbolster
andrewbolster / brutus
Created November 11, 2013 19:17
Solution to PyPool 11/11/13 Problem: You have intercepted a coded message. (Also available in plain text.) Your objective is to identify the source of the material. You can see from the character encoding of the HTML document that the encoded message is in Unicode. You have also received intelligence that the original message is in English and t…
import string
from urllib.request import urlopen
from collections import Counter
def getCipherText():
cipherreq = urlopen("http://pypool.daihuws.me.uk/crypto/encrypted.txt")
cipherstr = cipherreq.read().decode("utf-8")
cipherreq.close()
return cipherstr
@andrewbolster
andrewbolster / RCUK Arduino
Created November 15, 2013 11:15
Jing Deng's Arduino code for RCUK Magherafelt project
/*
Melody
Plays a melody
circuit:
* 8-ohm speaker on digital pin 8
created 21 Jan 2010
modified 30 Aug 2011
@andrewbolster
andrewbolster / NI or Irish Inventions
Created December 2, 2013 19:58
List of Irish Inventions
* C14 - Whiskey
* 1680s - Chocolate Milk
* 1730 - the concept of an entrepreneur - Richard Cantillion introduced the term before Jean-Baptiste Say in his work
* 1813 - the mining safety lamp
* 1836 - the induction coil
* 1844 - the syringe
* 1851 - the stereo-stethoscope
* 1866 - the trans-atlantic phone call
* 1891 - the torpedo
* 1884 - the steam turbine