Skip to content

Instantly share code, notes, and snippets.


Jordan Matelsky j6k4m8

View GitHub Profile
j6k4m8 /
Created Aug 17, 2020
Set up an infinite Blender background (beveled plane), with Camera, Focus-empty, and DOF
import math
import bpy
def add_infinite_background(coll_name = None):
mesh ="InfiniteBackground")
obj =, mesh)
col ="Collection") = obj
View Tmux for Absolute

new session

the first time after boot, start a new tmux session:


(it's working if your shell has a green bar at the bottom)

EC2_NAME = "x1.32xlarge"
def get_uptime():
with open('/proc/uptime', 'r') as f:
uptime_seconds = float(f.readline().split()[0])
return uptime_seconds
j6k4m8 / vol
Created Dec 11, 2019
Raspberry Pi Volume Control. Use with `vol 70` for 70% volume
View vol
#!/usr/bin/env python
import subprocess
import sys
if len(sys.argv) > 1:
subprocess.check_output("amixer sset 'PCM' {}%".format(sys.argv[1]), shell=True)
print(subprocess.check_output("amixer get 'PCM' | grep '%'", shell=True).split()[3].strip('[]'))
j6k4m8 /
Last active Jan 24, 2020
Comparator overrides

Access REST endpoints in "object" dot-notation and pandas-like index-notation in Python.

Example usage:

Posts = RemoteDataProvider(
    list_all=lambda: requests.get("").json(),
    get_one=lambda x: requests.get(f"{x}").json(),
j6k4m8 / tv
Created Nov 5, 2017
rpi scripts
View tv
#!/usr/bin/env python
import os
import sys
import subprocess
if (sys.argv[1] == 'on'):
subprocess.check_output('/opt/vc/bin/tvservice -p', shell=True)
if len(sys.argv) > 2 and sys.argv[2] == "up":
j6k4m8 / data.Nov-2-2017.json
Last active Nov 3, 2017
Activity on 365papers tweets, re: media
View data.Nov-2-2017.json
"data": [{"id": "926202781534388224", "has_media": true, "favorites": 0, "retweets": 0}, {"id": "925899260981399553", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "925466309869043714", "has_media": false, "favorites": 2, "retweets": 0}, {"id": "925107363782283269", "has_media": true, "favorites": 1, "retweets": 0}, {"id": "924714332591620097", "has_media": false, "favorites": 2, "retweets": 0}, {"id": "924327510124441602", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "923986889803223040", "has_media": false, "favorites": 2, "retweets": 1}, {"id": "923752187288870914", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "923376386047344640", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "923017521296543744", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "922573311799975936", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "922210485453426691", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "921818671022051333", "has_media
j6k4m8 /
Created Jul 9, 2017
How to write friendly Jupyter Notebooks

Jupyter Notebook Conventions


Notebooks are designed for easy reproducibility and code-sharing. Babysitting and debugging someone else's notebook sucks. Don't curse your friends with this burden!

When a user opens your notebook, they should be able to run all cells in order without any additional intervention.

Inputs that must be made to enable the code to run (e.g. password prompts, API tokens, etc) should be requested as soon as the notebook starts running.

Here's the TLDR:

j6k4m8 /
Last active Jun 27, 2019
How to git nicely with others

How to Git Nicely

Pull latest master.

git checkout master
git pull origin master

Check out a new feature-branch.

j6k4m8 / ipinfo
Last active Sep 21, 2017
Python: Get local, global, or router IP from the command line
View ipinfo
#!/usr/bin/env python3
./ipinfo [router|local|global]
./ipinfo geo [ip]
For example, to get your OWN location:
./ipinfo geo $(ipinfo global)
You can’t perform that action at this time.