Skip to content

Instantly share code, notes, and snippets.

🙌
🙌

Loisaida Sam loisaidasam

🙌
🙌
Block or report user

Report or block loisaidasam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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"
@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 / 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)
###
@loisaidasam
loisaidasam / 1_problem.py
Last active Oct 5, 2018
Python help! How to make a static, yet dynamic, property in a base class?
View 1_problem.py
SERVICE_ID_TACO_BELL = 1
SERVICE_ID_T_MOBILE = 2
SERVICE_NAMES = {
SERVICE_ID_TACO_BELL: "Taco Bell",
SERVICE_ID_T_MOBILE: "T-Mobile",
}
class BaseService(object):
@loisaidasam
loisaidasam / required_subclass_property.py
Created Oct 1, 2018
Requiring a Python class property to be explicitly set in its subclasses
View required_subclass_property.py
# Base class
In [1]: class Foo(object):
...: @property
...: def bar(self):
...: raise NotImplementedError
...:
# Subclass 1, with property explicitly set
In [2]: class Foof(Foo):
...: bar = "taco"
@loisaidasam
loisaidasam / boolean_ordering.txt
Last active Sep 24, 2018
The truth about boolean ordering in Postgres
View boolean_ordering.txt
master=> SELECT * FROM (VALUES (1, true), (2, false), (3, null)) AS t (id,value);
id | value
----+-------
1 | t
2 | f
3 |
(3 rows)
master=> SELECT * FROM (VALUES (1, true), (2, false), (3, null)) AS t (id,value) order by value;
id | value
@loisaidasam
loisaidasam / get-all-the-emojis.sh
Created Aug 13, 2018
Get a list of ALL THE EMOJIS!
View get-all-the-emojis.sh
#!/bin/bash
# Via https://github.com/iamcal/emoji-data
# Requires jq
# https://stedolan.github.io/jq/
curl -Ss "https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json" | jq '[.[] | .short_name]'
You can’t perform that action at this time.