Skip to content

Instantly share code, notes, and snippets.

Adam "Cezar" Jenkins emperorcezar

Block or report user

Report or block emperorcezar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@emperorcezar
emperorcezar / open-pr
Created Sep 13, 2018
Open pull request url from command line on mac
View open-pr
#!/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 Sep 10, 2018
Print TTLs from Redis for a set of keys in a file
View printttl.py
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):
View keybase.md

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:

View unpickle.py
import sys
import types
import pprint
from pickle import Unpickler
pp = pprint.PrettyPrinter(indent=4)
class GenericClass(object):
def __new__(cls, *p, **k):
View redis_get_keysizes.py
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')
View redis_latency.py
import logging
import os
import time
import redis
import statsd
logger = logging.getLogger(__name__)
@emperorcezar
emperorcezar / mycommand
Created Apr 27, 2017
Leave a virtualenv from the parent shell
View mycommand
#/usr/bin/env bash
if [[ $VIRTUAL_ENV ]]; then
source $VIRTUAL_ENV/bin/activate
deactivate
fi
exec command mycommand.py "$@"
View memory_viewer.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
View gist:b9f11a1899338bdd5d14
from __future__ import absolute_import
import logging
import celery
from django.conf import settings
class NoHardTimeoutFilter(logging.Filter):
def filter(self, record):
You can’t perform that action at this time.