Skip to content

Instantly share code, notes, and snippets.

View bitle's full-sized avatar

Damir Suleymanov bitle

View GitHub Profile
@bitle
bitle / SimpleHttpServer
Created April 4, 2014 14:20
Serve current dir as web server
python -m SimpleHTTPServer
@bitle
bitle / Integrate with Google button
Last active August 29, 2015 14:01
Integrate with Google button
<script type="text/javascript" src="https://apis.google.com/js/platform.js"></script>
<div class="g-additnow" data-applicationid="307208526595"></div>
@bitle
bitle / gist:f2c96cdeb212fabf8fc1
Created July 5, 2014 02:48
OSX Notification from bash
osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title" subtitle "subtitle"'
@bitle
bitle / validate-style.py
Created January 21, 2015 21:20
Git message format git hook
#!/usr/bin/python
import sys, os
from subprocess import call
message_file = sys.argv[1]
def check_format_rules(lineno, line):
real_lineno = lineno + 1
if lineno == 0:
@bitle
bitle / templateglob.py
Created September 3, 2015 20:39
Loop plugin for Ansible 2 for recursive template lookup
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import glob
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
@bitle
bitle / cprofile
Created September 24, 2015 14:54
from datetime import datetime
#import cProfile
import os
import StringIO
class InstrumentMiddleware(object):
# def process_request(self, request):
# if 'profile' in request.REQUEST:
# request.profiler = cProfile.Profile()
# request.profiler.enable()
from collections import defaultdict
import collectd
import psycopg2
config = {
'connection_string': 'dbname=pgbouncer user=np_db_user port=6432'
}
def get_stats():
conn, cur = None, None
@bitle
bitle / kill_defunct.sh
Created November 18, 2015 18:47
Kill defunct processes
# Find all parents and kill the whole process tree
ps xao pgid,ppid,pid,comm | grep defunct | awk '{print -$2}' | sort -n | uniq -d | xargs sudo kill -9
@bitle
bitle / jfrog_billing_report.json
Last active November 10, 2023 09:25
Lnav format for reading JFrog Billing Report files
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"bunyan_log": {
"title": "JFrog Billing Report",
"url": "https://gist.github.com/bitle/65b45ce807ca3bc84183145efee9528f",
"description": "Lnav format for reading JFrog Billing Report files",
"json": true,
"file-pattern": "artifactory-traffic-.*.log",
"line-format": [
{