Skip to content

Instantly share code, notes, and snippets.

View reillysiemens's full-sized avatar
🦀
cargo install coffee

Reilly Tucker Siemens reillysiemens

🦀
cargo install coffee
View GitHub Profile
@reillysiemens
reillysiemens / virtualenv_and_pip.md
Last active August 29, 2015 13:56
A brief introduction to using virtualenv and pip with Python 3.

###Using Virtualenv

To create and use a new Python 3 virtual environment you can run the commands below.

####Creating a Virtualenv

virtualenv -p /usr/bin/python3 ~/.virtualenvs/<name of your virtualenv>

Keybase proof

I hereby claim:

  • I am reillysiemens on github.
  • I am reillysiemens (https://keybase.io/reillysiemens) on keybase.
  • I have a public key whose fingerprint is EA26 C944 1A6C 40E4 0E73 B4EC 1B45 8E7C 7CB1 54A9

To claim this, I am signing this object:

@reillysiemens
reillysiemens / contributing_to_github_projects.md
Last active August 29, 2015 14:02
Contributing to GitHub Projects

Contributing to GitHub Projects

  1. Review contributing guidelines

    Frequently a repository will have [guidelines for contributing][contrib-guide]. Your first order of business should always be to scope those out so your pull request will have a better chance of being accepted.

  2. Fork the intended repository

Click the Fork button on the default page of the repo you want to work on.

@reillysiemens
reillysiemens / pokémon.coffee
Created September 2, 2014 03:25
I choose you!
#!/usr/bin/env coffee
# There are only 151 Pokémon.
Pokémon = [ "Bulbasaur", "Ivysaur", "Venusaur", "Charmander", "Charmeleon",
"Charizard", "Squirtle", "Wartortle", "Blastoise", "Caterpie",
"Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey",
"Pidgeotto", "Pidgeot", "Rattata", "Raticate", "Spearow", "Fearow",
"Ekans", "Arbok", "Pikachu", "Raichu ", "Sandshrew", "Sandslash",
"Nidoran♀", "Nidorina", "Nidoqueen", "Nidoran♂", "Nidorino",
"Nidoking", "Clefairy", "Clefable", "Vulpix", "Ninetales",
@reillysiemens
reillysiemens / steamstats.py
Created January 4, 2015 04:58
Stats for your Steam!
#!/usr/bin/env python3
import re
from collections import namedtuple
INTERESTING_THRESHOLD = 7.5 # Interesting threshold.
DISINTERESTING_THRESHOLD = 2.0 # Disinteresting threshold.
r = re.compile("(.*)\n(\d*.\d*) hrs on record") # Regex for name/hours
Game = namedtuple('Game', 'name, hours') # Namedtuple for easy record access.
@reillysiemens
reillysiemens / tabdump.coffee
Last active August 29, 2015 14:14
Dump tabs from Firefox tab groups to JSON.
#!/usr/bin/env coffee
###
Copyright (c) 2015, Reilly Tucker Siemens <reilly.siemens@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@reillysiemens
reillysiemens / roulette.bash
Last active January 14, 2016 07:20
I got bored.
alias roulette='for i in {0..5}; do echo -e "import random as rand; import webbrowser as wb; import string as s; import urllib.request as req\ntry:\n\tu = \"https://bit.ly/%s\" % \"\".join(rand.choice(s.ascii_letters+s.digits) for _ in range(0, 6))\n\tr = req.urlopen(u)\n\tprint(\"BANG!\")\n\twb.open(u)\nexcept:\n\tprint(\"click\")" | python3; done'
@reillysiemens
reillysiemens / README.md
Last active July 19, 2017 04:53
Testing Click Applications with Pytest

Requirements

  • Python 3.6
  • pip
  • virtualenvwrapper

Instructions

Copy these files into a directory. Run the tests.

mkvirtualenv greet &amp;&amp; pip install -e .'[dev]' &amp;&amp; pytest -v
@reillysiemens
reillysiemens / avatar.md
Last active September 17, 2017 20:05
Generate a PNG with the remote IP address in it.

avtar.png

These files are web applications that generate PNGs on request containing a friendly greeting with the IP address of the requester.

The PHP was originally written by Andrew Kvalheim probably around 2010. Its filename at that time was avatar.png, so as to give the illusion that it was a static file.

I wrote the Python many years later in an attempt to understand what Andrew had

@reillysiemens
reillysiemens / minecraft-backup.sh
Created January 21, 2018 01:07
Minecraft Backup
#!/bin/sh
: ${MINECRAFT_WORLD="survival"}
src="/srv/${MINECRAFT_WORLD}/world"
dst="/var/games/minecraft/${MINECRAFT_WORLD}.txz"
send_command() {
world=$1
cmd=$2