Skip to content

Instantly share code, notes, and snippets.

View jason-neal's full-sized avatar
👨‍💻

Jason Neal jason-neal

👨‍💻
  • NZ
View GitHub Profile
#https://stackoverflow.com/questions/19576742/how-to-clone-all-repos-at-once-from-github
USER=jason-neal; PAGE=1
curl "https://api.github.com/users/$USER/repos?page=$PAGE&per_page=100" |
grep -e 'git_url*' |
cut -d \" -f 4 |
xargs -L1 git clone
@jason-neal
jason-neal / test_debug_pycharm.py
Last active December 18, 2017 16:24
Debugging tests with pycharm, add pytest call to if __name__ == '__main__':
# https://stackoverflow.com/questions/14086067/debugging-pytest-post-mortem-exceptions-in-pycharm-pydev
# Are you using pytest-pycharm plugin?
# Looks like it works for me. Create virtualenv, pip install pytest pytest-pycharm,
# use this virtualenv at PyCharm Edit configuration -> Python Interpreter and
# then run with Debug ... Example:
import pytest
def test_me():
assert None
@jason-neal
jason-neal / iterate_styles.py
Created January 12, 2018 12:26
Get iterable list of matplotlib styles.
import matplotlib
colors_array = list(matplotlib.colors.cnames.keys())
lines_array = list(matplotlib.lines.lineStyles.keys())
markers_array = list(matplotlib.markers.MarkerStyle.markers.keys())
@jason-neal
jason-neal / git-updater
Last active May 2, 2018 10:17 — forked from adilbaig/git-updater
A bash script to update your git repos in the background. It also pops up a user notification when a repo is synced
#!/bin/bash
# This is required for `notify-send` to work from within a cron.
# For Ubuntu
# http://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab/346580#346580
# eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
# For Fedora
export DISPLAY=:0.0
export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME session)/environ)
@jason-neal
jason-neal / apply_pre-commit_patch
Last active August 1, 2018 08:55
Manually apply a pre-commit cached patch.
# Manual call if pre-commit fails to restore unstaged work
git apply --whitespace=nowarn path\to\patch\patchXXXXXXXXX
# From https://github.com/pre-commit/pre-commit/blob/c3c6175c94ac043b0e6597238f712b615fbdb45f/pre_commit/staged_files_only.py
# def _git_apply(patch):
# args = ('apply', '--whitespace=nowarn', patch)
# try:
# cmd_output('git', *args, encoding=None)