Skip to content

Instantly share code, notes, and snippets.

@WilliamQLiu
WilliamQLiu / index.html
Created November 17, 2014 20:25
D3 Mouse Events
<!DOCTYPE html>
<!-- How to create Mouse Events for D3 -->
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<!-- CSS (Styling) -->
<style type="text/css">
@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 / supervisord.conf
Created January 31, 2017 16:00
Example Supervisord configuration for uwsgi
[program:something]
user=vagrant
directory=/app/someapp/
command=uwsgi --ini /app/someapp/something/uwsgi.ini -H /home/vagrant/.virtualenvs/venv/
autorestart=true
start=true
@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 / 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';