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"
@andrewbolster
andrewbolster / Lawnmower.ipynb
Created September 5, 2014 09:04
Lawnmower Process
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Since Farbot triggers freenodes flood detection, here's the help.
<question> why not zoidberg? - Generates a Why Not Zoidberg? meme
<something> does not work that way! - Generates a Morbo meme
<something> is bad and you should feel bad - Generates a Zoidberg meme
<things> are bad and you should feel bad - Generates a Zoidberg meme
<things> do not work that way! - Generates a Morbo meme
Events:
alot - Shows a picture of an alot
countdown [for] #meetupname# e.g. countdown punerbmeetup
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# basically, want to parse a file, load values in it into a dictionary (name, x, y, z, r, g, b), and scatter lot them, with labels based on RGB color
# <codecell>
%matplotlib inline
@andrewbolster
andrewbolster / os.nice.py
Created May 7, 2014 10:23
Code Samples for os.nice post
import os
...
def thread_mask(args):
# Properly Parallel RNG
#http://stackoverflow.com/questions/444591/convert-a-string-of-bytes-into-an-int-python
myid=current_process()._identity[0]
np.random.seed(myid^struct.unpack("<L",os.urandom(4))[0])
os.nice(5)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def update_filter(self):
#####################################################################################
# KALMAN STEP #
#####################################################################################
t = self.t_index
#_Y = np.vstack(np.concatenate((self.Inertial_Measurement.flatten(),self.TOF_Measurement.flatten())))
Y = np.vstack(self.SIM.Measurement)
# Form estimated error correction of positions form reduced form
# Y is the positions observed, and is corrected by the X_estimation from the previous round
@andrewbolster
andrewbolster / Random Three Vector.py
Last active August 5, 2023 11:58
Generate a random 3D unit vector with uniform spherical distribution
def random_three_vector():
"""
Generates a random 3D unit vector (direction) with a uniform spherical distribution
Algo from http://stackoverflow.com/questions/5408276/python-uniform-spherical-distribution
:return:
"""
phi = np.random.uniform(0,np.pi*2)
costheta = np.random.uniform(-1,1)
theta = np.arccos( costheta )

Keybase proof

I hereby claim:

  • I am andrewbolster on github.
  • I am bolster (https://keybase.io/bolster) on keybase.
  • I have a public key whose fingerprint is 03D4 CCE9 AC04 1177 3D00 924D 49DC 9F11 AEFD 5969

To claim this, I am signing this object:

10:51 <bolster> Is it passable to describe a movie as being "If Ed Wood and Christopher Walken had a thalidomide baby" or is that too much?
10:51 <bolster> Oh, maybe should have started with "Morning"
10:56 <clairebones> bolster: if it's the movie I think you're referring to it's probably apt
10:58 <^Richard> o_O
10:59 <bolster> clairebones: yup, just concious that as a statement it sits on the very bloodiest edge of decorum. Much like the movie.
11:02 <stealthii> film in question: http://imgur.com/C0PoSVX
11:03 <^Richard> even the description is fucking mental.
11:03 <stealthii> that's my favourite bit.
11:04 <stealthii> of course he didn't hit her
11:04 <stealthii> men don't hit.