Skip to content

Instantly share code, notes, and snippets.

View neuroticnerd's full-sized avatar

Bryce Eggleton neuroticnerd

View GitHub Profile
@neuroticnerd
neuroticnerd / README.rst
Created September 17, 2016 00:25
Convenience wrapper for Python packaging using twine

Twine wrapper script

Even once you've figured out the intricacies of Python packaging and figure out why its a good idea to use twine, its still nice to have a few convenience tools to make using it easier.

The pypackage.sh file should be placed in ~/.scripts as ~/.scripts/pypackage and then in your ~/.bash_profile you should have export PATH="$HOME/.scripts:$PATH" so that it

@neuroticnerd
neuroticnerd / fizzbuzz.py
Last active September 9, 2016 19:25
Using FizzBuzz as an exercise in coding
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Sure, I had been aware that FizzBuzz existed, and had heard about it in
passing, but never had it actually been used in any interview I had been a
part of. Until now. The actual premise of the question is just as simple as
it was designed to be, but what if you wanted to improve upon it? This is
just a random exercise in improving the algorithm. For science.
FIZZBUZZ:
@neuroticnerd
neuroticnerd / setup_adb_sideloading.rst
Last active May 24, 2016 22:19
Setting up ADB sideloading on FireTV (OS X)

Setting up ADB Sideloading for FireTV (OS X)

The first step is to download the .apk file of the app which you want to sideload into your 'Downloads' folder. Since Google only wants you to access apps via whatever methods they provide, you cannot just download it directly from the Google Play store. There are essentialy two methods to accomplish the task of downloading. You can either use one of the browser extensions available for the job, or one of the online sites which proxy the download for you.

@neuroticnerd
neuroticnerd / twitchtv_rpi2.rst
Last active November 12, 2022 08:12
Streaming twitch.tv on your Raspberry Pi 2

Streaming twitch.tv on your Raspberry Pi 2

The following will explain the steps necessary to stream twitch.tv (as well as other media sites like YouTube) on the Raspbian (wheezy) distribution for the Raspberry Pi 2. While you should be able to accomplish the following instructions with Python 2.6.x, I recommend using 2.7.10+.

System Updates

@neuroticnerd
neuroticnerd / django-settings-utils.py
Created October 26, 2015 14:25
Utility functions for Django settings.py
import os
# utility for getting settings from the environment
NOT_PROVIDED = object()
def env(key, default=NOT_PROVIDED, coerce=str):
if default is NOT_PROVIDED:
val = os.environ.get(key)
@neuroticnerd
neuroticnerd / sublime-user-settings.json
Last active June 28, 2016 15:52
Sublime user settings for Python coding
{
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"default_line_ending": "unix",
"drag_text": false,
"draw_white_space": "all",
"enable_telemetry": false,
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
@neuroticnerd
neuroticnerd / python-on-ubuntu.sh
Last active July 27, 2018 07:09
Python 2.7.9 on Ubuntu 14.04.2 (without overwriting original version)
#! /usr/bin/env bash
# http://smirnov-am.blogspot.com/2015/04/installation-of-python-279-in-ubuntu.html
# http://davebehnke.com/python-pyenv-ubuntu.html
# https://renoirboulanger.com/blog/2015/04/upgrade-python-2-7-9-ubuntu-14-04-lts-making-deb-package/
# install dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
@neuroticnerd
neuroticnerd / openssl-file-encryption.rst
Last active August 29, 2015 14:18
File encryption with OpenSSL

File Encryption Using OpenSSL RSA Key

Because of the way that the algorithm used works, you cannot encrypt an amount of information greater than the size of the key being used. That is, a key of size 2048 would allow you to encrypt 2048 bytes of information. This means that just using the key by itself, it cannot be used on arbitrarily large pieces of data such as files.

The solution is to generate a random key which can be used for

@neuroticnerd
neuroticnerd / python-logging.rst
Created February 20, 2015 00:02
debunking the myth that using logging instead of print is too difficult!

python logging demystified!

disclaimer

This has been written with the latest version of Python 2 in mind (currently 2.7.9), and while the general premise holds true for