Skip to content

Instantly share code, notes, and snippets.

Multi-repo PRs-awaiting-review finder

This script adds two commands to your shell:

  • show-waiting-prs lists PRs awaiting review in the specified repository. It'll format them into a nice table (but not truncate any information, so it might be wider than your terminal). Example: show-waiting-prs relsqui/oobash
  • all-waiting-prs does that for every repo with the specified owner, formatting the result into one uniform table that might truncate usernames or PR titles to fit your terminal, but never URLs. Example: all-waiting-prs relsqui
    • Add a second argument to filter by a repository tag: all-waiting-prs relsqui game

Setup

  1. Install and configure the GitHub CLI
without extra whitespace * one * two * three
with extra whitespace
@relsqui
relsqui / degree.py
Created November 29, 2017 06:48
Automating "if x < a, elif x < b, elif x < c ..." blocks.
degrees = {0: "no", 2:"a little", 5:"some", 8:"quite a bit of", 11:"way too much"}
def degree(d):
for threshold, descriptor in sorted(degrees.items(), key=lambda x: x[0]):
if d <= threshold:
return descriptor
return degrees[max(degrees.keys())]
for x in range(15):
print("{0}\tI ate {1} candy.".format(x, degree(x)))
@relsqui
relsqui / LICENSE
Created February 20, 2017 07:28
Animated ASCII art fish for your screenrc.
Copyright 2017 Finn Ellis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@relsqui
relsqui / daily.sh
Created February 11, 2017 12:41
A little script for making daily writing really easy.
#!/bin/bash
# <CONFIG>
# set to non-null to allow any user to read your dailies
# if you don't set this or daily_group, only you can read your dailies
public_dailies=
# set to a group name to allow that group to read your dailies
# (this is ignored if public_dailies is set)
@relsqui
relsqui / most_rulings.py
Last active May 14, 2016 06:34
Find the maximum unique rulings on a Magic card.
#!/usr/bin/python3
import json
print("Loading ... ", end="")
with open("AllCards-x.json") as f:
# that's http://mtgjson.com/json/AllSets-x.json.zip, unzipped
cards = json.loads(f.read())
print("found {} cards.".format(len(cards)))
@relsqui
relsqui / output.txt
Created May 5, 2016 22:12
The stupidest python quine
[finnre@ruby ~]$ python quine.py
File "quine.py", line 1
File "quine.py", line 1
^
IndentationError: unexpected indent
@relsqui
relsqui / maketxt.sh
Last active May 5, 2016 23:15
Reads set files as formatted by mtgjson on stdin and outputs a concordancer-ready text file of non-vanilla cards with metadata in angle brackets.
#!/bin/bash
for set in *.json; do
echo "$set ..." >&2
# unix2dos converts line endings for the sake of Windows-based concordancers
# it's in the dos2unix package (named for the opposite tool)
cat $set | ./mtgcorpus.py | unix2dos > $(basename $set .json).txt
done
echo "done" >&2
@relsqui
relsqui / mininog.py
Last active December 18, 2015 04:28
AoC Day 17, Mini Version
import sys,itertools as i
s=map(int,sys.stdin)
r=1
while r:
c=sum(sum(d)==150for d in i.combinations(s,r));r+=1
if c:r=0;print c
> iter = Utils::iterate((string[]) {"foo", "bar", "baz"});
> string a;
> while (iter(&a)) {
+ printf("%s\n", a);
+ }
foo
bar
baz