Skip to content

Instantly share code, notes, and snippets.

Kert kaidokert

  • San Francisco, CA
Block or report user

Report or block kaidokert

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
View gist:b4f7bca1e6e496aa61b80686ac991bb6
# install
find . -iname "*xml" -exec sh -c 'xq . {} | yq -S -y . > `dirname {}`/`basename {} .xml`.yaml' \;
kaidokert /
Last active Apr 29, 2018
Tracing excessive callers to re.compile in
callers = {}
def _ghetto_compile(pattern, flags=0):
import inspect
frame = '{}'.format(inspect.currentframe().f_back.f_code)
val = callers.setdefault(frame,0)
callers[frame] = val + 1
# print(frame)
if '' in frame:
kaidokert /
Created Nov 29, 2017
Simple AWS Lambda script that self-installs dependencies
import json
import logging
import pip
import site
# installed by lambda env
# import six
# import boto3
# from dateutil.easter import *
kaidokert /
Last active Nov 24, 2016
Django hooks to log slow database queries from celery tasks
import logging
from django.db import connection
from django.conf import settings
from celery.signals import task_prerun, task_postrun
from time import time
kaidokert /
Created Jul 22, 2016 — forked from leycec/
`@beartype` Decorator and Unit Test Suite Thereof
#!/usr/bin/env python3
`@beartype` decorator, implementing a rudimentary subset of PEP 484-style type
checking based on Python 3.x function annotations.
See Also
Stackoverflow answer introducing the `@beartype` decorator.
kaidokert /
Last active Jul 14, 2016
Low fuss bottle app to serve static
import os
import sys
import bottle
static_root = os.path.abspath(os.path.dirname(__file__))
kaidokert / angular-bootstrap.html
Last active Jan 1, 2018
Minimal standalone bootstrap/angular page
View angular-bootstrap.html
<!DOCTYPE html>
<html lang="en" xmlns="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="" rel="stylesheet">
<body class="" style="" xmlns:ng="" ng-app="fooApp" ng-strict-di>
# pip install retryz backoff
from __future__ import print_function
import random
import retryz
import backoff
def naughty_func():
picky = random.randint(1, 3)
import urlparse
import argparse
import psycopg2
class Bunch:
def __init__(self, **kwds):
kaidokert / salt_repo.sls
Created Jan 25, 2016
Salt minion install from official repos, migrating from PPA
View salt_repo.sls
{% set ver_str = [grains.os|lower,grains.osrelease,grains.osarch]|join('/') %}
{% set release = latest %} {# currently 2015.8 #}
{% set release = 2015.5 %}
- humanname: salt-repo
- name: "deb{{ ver_str }}/{{ release }} {{ grains.oscodename }} main"
- file: /etc/apt/sources.list.d/salt.list
- keyid: DE57BFBE
You can’t perform that action at this time.