Skip to content

Instantly share code, notes, and snippets.

@WilliamQLiu
WilliamQLiu / elk_logger.py
Last active April 3, 2018 14:26
Send to logstash
# send a sample message to logstash
import socket
import json
import sys
import pdb
HOST = 'localhost'
PORT = 5000
from ipdb import slaunch_ipdb_on_exception
with slaunch_ipdb_on_exception():
@WilliamQLiu
WilliamQLiu / gist:48d36a7dc5d0c0935970c14f08f5d90c
Created December 21, 2017 03:08
Make terminal cursor stop blinking
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ cursor-blink-mode off
@WilliamQLiu
WilliamQLiu / config
Last active May 13, 2017 14:48
Will's i3 config, minor edits for vim movement
# ~/.config/i3/config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
@WilliamQLiu
WilliamQLiu / debug_exception.py
Created February 17, 2017 00:14
Python debugging an exception
import sys
import traceback
try:
temp = None
temp = 1
except Exception as e:
print "Caused exception with %s" % str(e)
print "Caused exception with %s" % repr(e)
etype, value, tb = sys.exc_info()
@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 / kibana_remove_autocomplete
Created January 30, 2017 16:34
Remove Kibana Auto Complete Bar
// Run in console
// ==UserScript==
// @name Kibana autocomplete killer
// @namespace kibana
// @grant none
// @include https://<your kibana site>/*
// ==/UserScript==
function main() {
document.addEventListener('click', function() {
sed "s/$/,/g” myfilename.csv > newfilename.csv
@WilliamQLiu
WilliamQLiu / http-example.go
Created April 28, 2016 19:32
Http example with Go
// Run using `go run http2.go`
// We added in a Mux to help with routing
package main
import (
"fmt"
"io"
"net/http"
)
@WilliamQLiu
WilliamQLiu / gist:4d67acec0304d3707851
Created February 2, 2016 02:57
chown to own a file or directory
sudo chown -R $USER /usr/local