Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Jason Neal jason-neal

👨‍💻
  • NZ
View GitHub Profile
@jason-neal
jason-neal / apply_pre-commit_patch
Last active Aug 1, 2018
Manually apply a pre-commit cached patch.
View apply_pre-commit_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)
@jason-neal
jason-neal / git-updater
Last active May 2, 2018 — 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
View git-updater
#!/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 / iterate_styles.py
Created Jan 12, 2018
Get iterable list of matplotlib styles.
View iterate_styles.py
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 / test_debug_pycharm.py
Last active Dec 18, 2017
Debugging tests with pycharm, add pytest call to if __name__ == '__main__':
View test_debug_pycharm.py
# 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
View clone_repos.sh
#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
You can’t perform that action at this time.