Skip to content

Instantly share code, notes, and snippets.

View justinabrahms's full-sized avatar

Justin Abrahms justinabrahms

View GitHub Profile
@justinabrahms
justinabrahms / colortest.py
Created June 26, 2011 17:10 — forked from graven/colortest.py
Small utility to test terminal support for 256-color output.
#!/usr/bin/env python
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349
print "Color indexes should be drawn in bold text of the same color."
print
colored = [0] + [0x5f + 40 * n for n in range(0, 5)]
colored_palette = [
"%02x/%02x/%02x" % (r, g, b)
for r in colored
@justinabrahms
justinabrahms / gist:8994424
Created February 14, 2014 01:51
A simple HTTP proxy for speedy static file serving, sending dynamic requests to a backend web server.
/**
* A proxy for loading static files in development. Django doesn't handle this well.
*
* To run, do something like:
* npm install .
* node proxy.js --docroot=$PWD
*
* Then just visit http://localhost:9000/ as you normally would.
*/
var httpProxy = require('http-proxy');
@justinabrahms
justinabrahms / gist:5602542
Created May 17, 2013 23:11
A sample GitStreams.com email!
holman/dotfiles:
PR:91 dplarson -- Replace empty echo's with printf new line
#91: Replace empty echo's with printf new line
dplarson commented on issue 91: Makes sense.
bestiejs/benchmark.js:
#45: Newbie question

github pull request querying

I’m querying review statuses for team so they can get a sense of who is doing all of the PR approvals and how long things are taking.

URL: https://github-url-here/api/graphql Header: Authorization: Bearer

query {
  search(query: "org:ORGHERE is:pr created:>2021-01-01", type: ISSUE, last: 50) {
@justinabrahms
justinabrahms / invoke.sh
Created April 28, 2022 18:09
Information on how to generate a nodejs license scan using SBOMs
npm i --production
npx -p @cyclonedx/bom cyclonedx-node -o bom.json
python ../license-scan.py
@justinabrahms
justinabrahms / gist:1390864
Created November 24, 2011 07:59
extract archives from eshell
(defun if-string-match-then-result (to-match pairs)
"Takes a string to match and a list of pairs, the first element
of the pairs is a regexp to test against the string, the second of
which is a return value if it matches."
(catch 'break
(dolist (val pairs)
(if (string-match-p (car val) to-match)
(progn
(throw 'break (cadr val)))))
@justinabrahms
justinabrahms / avendar-id-parser.py
Created June 25, 2020 10:37
item parser for avendar.net
import re
from hashlib import sha256
class Item(object):
def __init__(self, item):
self.item = item
def __str__(self):
return self.item['name']
@justinabrahms
justinabrahms / .pdbrc.py
Created July 23, 2014 21:11
default pdbpp to start with sticky enabled
import pdb
class Config(pdb.DefaultConfig):
sticky_by_default = True
"""
The HOSTMAP variable is a dictionary of lists. The keys represent
roles of a server, the values represent the hostnames of machines that
fill those roles. If you are reading this, you likely know what you're
doing. If you don't know what you're doing, you probably want to put
your hostname into local_dev. Ensure it has a comma at the end, and
the hostname is a string.
You can get your hostname by typing `hostname` into a terminal.
"""
@justinabrahms
justinabrahms / gist:5673408
Created May 29, 2013 20:05
Short script which will grep your project for unused requirejs imports. Usage: `/path/to/file.sh application/js/directory`
#/bin/bash
JS_FILES=$(find "$1" -name "*.js")
for FILE in $JS_FILES; do
short_name=`basename $FILE`
filename="${short_name%.*}"
git grep --quiet $filename 1>/dev/null
if [ "$?" == "1" ]; then
echo "Should delete: $FILE"