Skip to content

Instantly share code, notes, and snippets.

View emperorcezar's full-sized avatar

Adam "Cezar" Jenkins emperorcezar

  • SpotHero
  • Mokena, IL
View GitHub Profile
@emperorcezar
emperorcezar / open-pr
Created September 13, 2018 18:57
Open pull request url from command line on mac
#!/bin/bash
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BASE_URL=$(git config remote.origin.url | sed "s/git@\(.*\):\(.*\).git/https:\/\/\1\/\2/")
open ${BASE_URL}/compare/${BRANCH}?expand=1
@emperorcezar
emperorcezar / printttl.py
Created September 10, 2018 17:45
Print TTLs from Redis for a set of keys in a file
import fire
import redis
import time
def print_ttl(redis_host, keyfile)
r = redis.Redis(host=redis_host)
with open(keyfile) as f:
for key in f:
if not r.exists(key):

Keybase proof

I hereby claim:

  • I am emperorcezar on github.
  • I am emperorcezar (https://keybase.io/emperorcezar) on keybase.
  • I have a public key ASCldOqg7jxmoHhy3VgZUoasXQj5gQZtMmKCi_7SGDBOHgo

To claim this, I am signing this object:

@emperorcezar
emperorcezar / MyAudioEquipment.md
Last active February 9, 2018 17:46
My Audio Equipment
import sys
import types
import pprint
from pickle import Unpickler
pp = pprint.PrettyPrinter(indent=4)
class GenericClass(object):
def __new__(cls, *p, **k):
import argparse
import redis
parser = argparse.ArgumentParser(description='Get sizes using key pattern.')
parser.add_argument('pattern', metavar='PATTERN', nargs=1,
help='pattern to use')
parser.add_argument('--host', dest='host', default='localhost',
help='redis host')
parser.add_argument('--port', dest='port', default=6379,
help='redis port')
import logging
import os
import time
import redis
import statsd
logger = logging.getLogger(__name__)
@emperorcezar
emperorcezar / mycommand
Created April 27, 2017 11:16
Leave a virtualenv from the parent shell
#/usr/bin/env bash
if [[ $VIRTUAL_ENV ]]; then
source $VIRTUAL_ENV/bin/activate
deactivate
fi
exec command mycommand.py "$@"
# This file is part of pyrasite.
#
# pyrasite is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyrasite is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
from __future__ import absolute_import
import logging
import celery
from django.conf import settings
class NoHardTimeoutFilter(logging.Filter):
def filter(self, record):