Skip to content

Instantly share code, notes, and snippets.

🙌
🙌

Loisaida Sam loisaidasam

View GitHub Profile
@loisaidasam
loisaidasam / README.md
Last active Apr 21, 2019
Sort git tags by semver
View README.md

If you're like me and you use semver for versioning your tags, you probably hate when you do this:

$ git tag -l
0.1.0
0.10.0
0.2.0
0.3.0
0.3.1
0.4.0
0.5.0
@loisaidasam
loisaidasam / README.md
Last active Apr 12, 2019
The Masters API!
View README.md
@loisaidasam
loisaidasam / git-find-large-files
Created Mar 15, 2019
Shows you the largest objects in your repo's pack file.
View git-find-large-files
#!/bin/bash
# git-find-large-files
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @see https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history/10622293#10622293
# @author Antony Stubbs
@loisaidasam
loisaidasam / would-you-rather
Last active Mar 5, 2019
Would You Rather (via rrrather.com API, using curl/jq)
View would-you-rather
#!/bin/bash
jq_str='(.title + ": " + .choicea + " OR " + .choiceb + " - " + .link + " (" + (.votes|tostring) + " votes)")'
curl -Ss "https://www.rrrather.com/botapi" | jq -r "$jq_str"
View postgres_queries_and_commands.sql
-- show running queries (9.2+)
SELECT pid, age(clock_timestamp(), query_start), usename, state, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start asc;
-- or if your query is very long/verbose
SELECT pid, age(clock_timestamp(), query_start), usename, state, substring(query, 1, 100)
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@loisaidasam
loisaidasam / currently_playing.txt
Created Feb 6, 2019
OSX/Applescript - get artist / title of the current track playing on Spotify
View currently_playing.txt
$ osascript -e "if application \"Spotify\" is running then tell application \"Spotify\" to get artist of current track & \" - \" & name of current track"
Tirzah - Fine Again
@loisaidasam
loisaidasam / histogram.py
Last active Feb 5, 2019
Extensible script for generating a histogram using `matplotlib`
View histogram.py
import argparse
import cPickle
import json
import math
import os.path
import matplotlib.pyplot as plt
@loisaidasam
loisaidasam / bellababy.sh
Created Feb 3, 2016
Download your bellababy photos
View bellababy.sh
#!/bin/bash
# To download your BellaBaby photos
# (people who come to the hospital and take photos of you and your newborn)
# Note: They are watermarked - you have to pay (big bucks) for the originals!
# This seemed to be the convention for my photos:
TAG="<photographer_name><date><your_last_name>"
# Files 1-9 have slightly different structure...
@loisaidasam
loisaidasam / threading_test.py
Last active Jan 25, 2019
Examining shared mutable objects in threading
View threading_test.py
import random
import threading
import time
class MyObject(object):
thread_id = None
@loisaidasam
loisaidasam / pipy-check
Last active Jan 23, 2019
Check the current version of a lib on pypi
View pipy-check
#!/bin/bash
###
# Check the current version of a lib on pypi
#
# https://gist.github.com/loisaidasam/2cb9bcc32312ca673c933ef07cdc706f
#
# Requires `curl` and [pup](https://github.com/ericchiang/pup)
###
You can’t perform that action at this time.