This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pprint | |
import unittest | |
class PrettyDiffPrinter(pprint.PrettyPrinter): | |
"""A pprint subclass to hide some differences | |
that usually don't matter in tests | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fix Kibana 3 terms_stats | |
// @namespace http://chivil.com/ | |
// @version 1.0 | |
// @description Try fixing Kibana 3 terms_stats queries not being accurate with low document count | |
// @author Romuald Brunet <[email protected]> | |
// @match -your-kibana-url- | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
ash_ffffind.py | |
v1.1 (September 14, 2015) | |
by [email protected] | |
Automatically downloads all images from ffffound saved by a specific user. | |
Will first try to download the image from the original source (to get the highest quality possible). | |
If that fails, it'll download the cached version from ffffound. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Phabricator rainbow columns | |
// @version 1.0 | |
// @description Automatically colorize phabricator workboard columns to spot them more easily | |
// @author Romuald Brunet | |
// @run-at document-end | |
// @grant none | |
// ====== /!\ You should probably restrict this to your local phabricator instance ====== | |
// @match http://my-phabricator-instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script check that the .py files that | |
# you're about to commit are syntactically valid | |
# Might want to check with a specific python binary | |
PYTHON=python | |
exit_status=0 | |
for file in $(git diff --cached --name-only --diff-filter=ACM | grep -e '\.py$') | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT user, pid, client_addr, waiting, query, query_start, NOW() - query_start AS elapsed | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' | |
-- AND EXTRACT(EPOCH FROM (NOW() - query_start)) > 1 | |
ORDER BY elapsed DESC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from time import time | |
from itertools import imap | |
from sqlalchemy import create_engine, Column, Integer, String, literal_column | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.ext.declarative import declarative_base | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import re | |
import sys | |
class ProgressBar(object): | |
""" | |
A simple progress bar for terminal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zsh <3 | |
vba() { | |
local venv | |
local base="." | |
while :; do | |
venv=($base/venv*/bin/activate(N)) | |
if [ $#venv = 1 ]; then | |
source $venv | |
return 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Abusing python default initialization to create static variables | |
def pompom(arg, static={'counter': 0}): | |
static['counter'] += 1 | |
print("Yup %d, %d") % (arg, static['counter']) | |
pompom(8) | |
pompom(42) | |
""" | |
Yup 8, 1 | |
Yup 42, 2 |