Skip to content

Instantly share code, notes, and snippets.

@WilliamQLiu
WilliamQLiu / sidekiq_monitoring
Created July 2, 2019 16:45 — forked from ngsmrk/sidekiq_monitoring
Sidekiq queue checking via rails console
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
Strosin-Osinski 1987 2015
Ratke, Ankunding and Wilkinson 1915 1943
Effertz-Swaniawski 1915 1937
Schimmel-Wuckert 1920 1980
Mayer-Schinner 2015 2015
Zulauf, Reichert and Bogisich 1912 1916
Weber-Skiles 2011 2011
Powlowski-Kutch 1960 1963
Lubowitz-Schmitt 1989 1995
Padberg, Johns and Gottlieb 1976 1992
@WilliamQLiu
WilliamQLiu / get_table_size.sql
Created January 30, 2019 23:51
Get Table Sizes (in MB) for a database
SELECT
table_name AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) as size
FROM information_schema.TABLES
WHERE table_schema = "my_database"
ORDER BY size DESC;
@WilliamQLiu
WilliamQLiu / Dockerfile
Created January 24, 2019 23:58
Dockerfile entrypoint to just run
ENTRYPOINT ["tail", "-f", "/dev/null"]
@WilliamQLiu
WilliamQLiu / secrets.py
Created September 17, 2018 17:36
Secrets
""" Create Quick Keys """
import secrets
print(secrets.token_urlsafe(64))
#'uT_aNtkVomcrkgZc5XFxKVlM3DnrBjcl_3P1yavGm2nqof74IZ5CR2Z1-0ga2jTK4i30I6RGsXodwXPq3repHQ'
# ^ don't use this one
@WilliamQLiu
WilliamQLiu / remove .pyc files
Created April 25, 2018 22:56
Remove .pyc files
find . -name \*.pyc -delete
@WilliamQLiu
WilliamQLiu / launch_ipdb_on_exception.py
Created April 25, 2018 22:54
Launch ipdb only on Exception
from ipdb import slaunch_ipdb_on_exception
with slaunch_ipdb_on_exception():
@WilliamQLiu
WilliamQLiu / run_scp.sh
Created April 10, 2018 19:17
scp example
# scp from a server to your local
scp username@serverhost.com:/file/you/want/log.txt .
@WilliamQLiu
WilliamQLiu / inspect.py
Created April 10, 2018 18:29
SQL Alchemy Database Introspection through MetaData
#%%
print "Importing libraries"
import pandas as pd
import sqlalchemy as sa
from sqlalchemy.engine import reflection
#%%
# DB Connection Info
print "Getting MySQL Connection on DB"
USER = 'someusername'
@WilliamQLiu
WilliamQLiu / save_query_to_csv
Last active April 20, 2018 21:57
Myclirc save file to csv
# Run below to save to csv - run each line by line
\T csv
\o ~/my_file.csv
select * from users where created_at > '2017-01-01';