Skip to content

Instantly share code, notes, and snippets.

View michael-erasmus's full-sized avatar

Michael Erasmus michael-erasmus

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@michael-erasmus
michael-erasmus / po_name.sh
Last active May 22, 2017 21:27
Copies the name of the first k8s container matching a service name into the clipboard
#Copies the name of the first k8s container matching a service name into the clipboard
#Requires jq and pbcopy (made for Mac OSX)
function po_name {
if [ -z "$1" ]
then
echo "Please specify the service name"
else
pattern=${1-$DEFAULT}
kubectl get po --output=json | jq -r '.items | .[] | .metadata.name' | grep $pattern | head -n 1 | tr -d '\n'| pbcopy
fi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
- view: redshift_query_alerts
derived_table:
sql: |
select
trim(s.perm_table_name) as table,
(sum(abs(datediff(seconds,
coalesce(b.starttime, d.starttime, s.starttime),
case
when
@michael-erasmus
michael-erasmus / emoji_count.sql
Created September 15, 2016 20:14
Buffer emoji updates count
DROP TABLE "public"."emoji_table";
CREATE TABLE "public"."emoji_table"
(
"emoji" VARCHAR(70)
,"meaning" VARCHAR(160)
)
DISTSTYLE ALL;
--got this file from http://stats.seandolinar.com/wp-content/uploads/2015/04/emoji_table.txt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@michael-erasmus
michael-erasmus / runtests.py
Last active April 13, 2016 07:03 — forked from jiffyclub/runtests.py
An IPython %runtests magic that does some very basic test function discovery, running, and reporting within IPython.
from IPython.core.magic import register_line_magic
import pandas as pd
@register_line_magic
def runtests(line):
"""
The %runtests magic searches your IPython namespace for functions
with names that begin with 'test'. It will attempt to run these
functions (calling them with no arguments), and report whether they
pass, fail (raise an AssertionError), or error (raise any other
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can't make this file beautiful and searchable because it's too large.
date,symbol,sentiment_signal
2012-10-14 13:00:00,AAPL,6
2012-10-15 13:00:00,AAPL,6
2012-10-16 13:00:00,AAPL,2
2012-10-17 13:00:00,AAPL,6
2012-10-18 13:00:00,AAPL,6
2012-10-19 13:00:00,AAPL,6
2012-10-20 13:00:00,AAPL,6
2012-10-21 13:00:00,AAPL,1
2012-10-22 13:00:00,MSFT,2