Skip to content

Instantly share code, notes, and snippets.

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@rduplain
rduplain / linode-node-balancer-500-limitation.md
Last active November 1, 2015 04:20
Linode NodeBalancer: Passive health checks lead to many false positives.

Linode's NodeBalancer assumes (as of Apr 2015) that a 500 response means that the node should be removed from rotation. Naturally, exceptions happen, so this is a very serious design limitation for any application which allows its code to have uncaught exceptions. I have opened a support ticket, with discussion copied here.

Ultimately, we had to rewrite our 500 responses to a non-50x response, which is strange to our application, but at least the change was limited to an nginx config and a single line of JavaScript to handle our status code as a server error. Linode specifically advised to use a non-50x response. All we need is a configuration in the NodeBalancer to not use passive checks on 500 Internal Server Error responses. There is no such configuration.

Due to the head-scratching nature of this configuration, we used 418 I'm a teapot in place of 500 responses. In nginx:

proxy_intercept_errors on;

error_page 500 =418 /_error/internal-serve

@husobee
husobee / png-lsb-steg.go
Created August 31, 2014 22:23
VERY simplified LSB stego example on PNGs (lossless)
// example of how to hide data in LSB of colors within a lossless png
package main
import (
"errors"
"flag"
"fmt"
"image"
"image/color"
"image/png"
@rduplain
rduplain / README.md
Last active December 6, 2023 15:08
Demo of the Python `code` module, for interaction and DSLs.

import code

This is a demonstration of the Python [code][1] module, which allows for an interactive interpreter to be embedded into a Python program.

code.interact(banner=None, readfunc=None, local=None)

Convenience function to run a read-eval-print loop. This creates a new instance of [InteractiveConsole][2] and sets readfunc to be used as the

@rduplain
rduplain / slides.md
Last active February 7, 2019 15:40
Use Werkzeug's web-based interactive debugger with Tornado.

Interactive Debugging in any Python Web Project

Ron DuPlain - PyOhio 2013

Turn this:

@rduplain
rduplain / get.py
Last active October 13, 2015 01:47
Build a road-trip curated mp3 directory of a podcast. Our car plays .mp3 files from CD & USB,
"Build a road-trip curated mp3 directory of a podcast."
# Developed against feedparser v5.1.2 and BeautifulSoup v3.2.1.
# pip install feedparser BeautifulSoup
import datetime
import re
import time
import urllib
@mkaito
mkaito / post-receive
Created July 27, 2012 02:49
post-receive hook to notify our hubot instance
#!/usr/bin/env ruby
# Notify hubot when someone pushes.
require 'net/http'
branches = []
cnum = 0
STDIN.each do |line|
(oldref, newref, refname) = line.split
branches.push `git rev-parse --symbolic --abbrev-ref #{refname}`.chomp
@rduplain
rduplain / commitments.rst
Created June 23, 2012 21:14
A commitment spec, a data model in structured text for injestion. Collaboration with mattd.

Life Area

Commitment 1

Program

@rduplain
rduplain / gist:2149194
Created March 21, 2012 16:19
PyCon 2012 Digest for WillowTree Apps

PyCon 2012 Digest

from DevOps team {rduplain,mattd,teebes}, to mobile developers at WillowTree Apps

Pronunciation

@ask
ask / gist:2014539
Created March 11, 2012 01:57
celery consumer service using boot-steps.
from celery import abstract
from celery import current_app
from kombu import Exchange, Queue
from kombu.mixins import ConsumerMixin
# need to subclass the result backend so that it uses a topic exchange
# instead of direct, and send the results for tasks using a routing_key
# of the format: