Skip to content

Instantly share code, notes, and snippets.

@jesseops
jesseops / prometheus.yml
Created October 18, 2022 21:50 — forked from reachlin/prometheus.yml
sample prometheus configuration explained
// For all the confusing Prometheus configuration and
// regular expressions,
// explained in examples.
// Remember, there are default values for each item if it's missing.
// regex is (.*),
// replacement is $1,
// separator is ;
// ,and action is replace
@jesseops
jesseops / requests.py
Created November 15, 2017 16:16
Global requests/socket timeouts + retries
"""
Monkey-Patch Requests for automatic timeouts and retries
Retries for rrDNS, timeouts because you should always do timeouts.
If you want these features, just do ```from $MYPACKAGE.requests import requests```.
"""""
import requests
@jesseops
jesseops / bin_fehbg
Last active February 20, 2017 02:12
dotfiles
#!/bin/bash
DIR=/home/jesse/Pictures/.wallpaper
feh --bg-scale `shuf -n1 -e $DIR/*`
@jesseops
jesseops / keybase.md
Created December 26, 2016 16:55
keybase.md

Keybase proof

I hereby claim:

  • I am jesseops on github.
  • I am jesseops (https://keybase.io/jesseops) on keybase.
  • I have a public key whose fingerprint is FAF3 1254 C227 178A BD29 B6A9 4167 3EF8 F5D2 AA8B

To claim this, I am signing this object:

@jesseops
jesseops / flask-yact.py
Created September 20, 2016 14:28
Simple support for YAML configuration in Flask
import yact
from flask import Flask, Config, jsonify
# Build custom configuration object
class YactConfig(Config):
"""
Customized config object
Extends Flask config to support YAML via YACT
"""
@jesseops
jesseops / circuitbreaker.py
Created September 15, 2016 18:01
A simple circuitbreaker, useful for timeouts, etc
from __future__ import print_function # I wrote this in py2, but wanted py3 compatibility
from time import sleep
from datetime import datetime, timedelta
class TrippedBreaker(Exception):
pass
class CircuitBreaker(object):
@jesseops
jesseops / tinkerwithblinker.py
Created September 15, 2016 17:46
Playing with Blinker (and threads )
import blinker
import threading
from time import sleep
# Create a blinker
shutdown = blinker.signal('shutdown', doc="you should shutdown when this signal is triggered")
@jesseops
jesseops / rtl8188_hostapd_setup
Last active August 29, 2015 14:06
Setup hostapd to support rtl8188cus
#!/bin/bash
error() {
printf '\E[31m'; echo "$@"; printf '\E[0m'
}
info() {
printf '\E[32m'; echo "$@"; printf '\E[0m'
}