Skip to content

Instantly share code, notes, and snippets.

@gerhard
gerhard / gist:1707291
Created January 30, 2012 22:44
This is how New Relic follows up on their trials
This was sent by a New Relic account executive to one of my co-workers as a
follow-up to the trial. Generally speaking, it's a good idea to not patronise
your potential customers. There's no room for more than a single dot in a
business e-mail. Use a spell-checker for your e-mails if you can't spell. Write
in clear English. What do you think?
Hello <name>,
@apk
apk / websock.sh
Created April 18, 2012 15:51
A web socket server as a bash script.
#!/bin/bash
# WebSocket shell, start & browse to http://<Host>:6655/
# Requires bash 4.x, openssl.
# Author: rootshell@corelogics.de (which isn't me, apk)
coproc d { nc -l -p 6656 -q 0; }
nc -l -p 6655 -q 1 > /dev/null <<-ENDOFPAGE
HTTP/1.1 200 OK
<html><head><script language="javascript">
var url = location.hostname + ':' + (parseInt(location.port) + 1);
% ruby grep.rb logstash-1.1.[0123]-monolithic |sort | uniq -c
1 /files/logstash//logstash-1.1.1-monolithic.jar
1 /files/logstash//logstash-1.1.2-monolithic.jar
399 /files/logstash/logstash-1.1.0-monolithic.jar
4 /files/logstash/logstash-1.1.1-monolithic-jruby1.7.0RC1.jar
308 /files/logstash/logstash-1.1.1-monolithic.jar
537 /files/logstash/logstash-1.1.2-monolithic.jar
77 /files/logstash/logstash-1.1.3-monolithic.jar
@probonopd
probonopd / traceback.py
Last active February 10, 2018 17:39
Show flask traceback when running on production server
import traceback
@app.errorhandler(500)
def internal_error(exception):
"""Show traceback in the browser when running a flask app on a production server.
By default, flask does not show any useful information when running on a production server.
By adding this view, we output the Python traceback to the error 500 page.
"""
trace = traceback.format_exc()