A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.
$ staticServer <lang> <port> #port is optional, default is 8000
// note: -D_7ZIP_ST is required when compiling on non-Windows platforms | |
// g++ -o lzma_sample -std=c++14 -D_7ZIP_ST lzma_sample.cpp LzmaDec.c LzmaEnc.c LzFind.c | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <memory> | |
#include "LzmaEnc.h" | |
#include "LzmaDec.h" |
A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.
$ staticServer <lang> <port> #port is optional, default is 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
HTTP Archive (powered by HAR files): www.httparchive.org
HAR Viewer: http://code.google.com/p/harviewer/
import logging | |
import socket | |
log = logging.getLogger('udp_server') | |
def udp_server(host='127.0.0.1', port=1234): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
# Send a metric to statsd from bash | |
# | |
# Useful for: | |
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/) | |
# init scripts | |
# sending metrics via crontab one-liners | |
# sprinkling in existing bash scripts. | |
# | |
# netcat options: | |
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed. |