Skip to content

Instantly share code, notes, and snippets.

View kleinron's full-sized avatar
🦉
C'est moi

Ron Klein kleinron

🦉
C'est moi
View GitHub Profile
@Treeki
Treeki / lzma_sample.cpp
Created May 24, 2017 21:52
simple LZMA SDK compression/decompression example
// 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"
@ahmedelgabri
ahmedelgabri / gist:8122545
Last active December 22, 2020 08:46
Shell function to open a static server (Python, Ruby or PHP)

Static server shell function

A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.

How it works

$ staticServer <lang> <port> #port is optional, default is 8000
@willurd
willurd / web-servers.md
Last active April 25, 2024 01:54
Big list of http static server one-liners

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.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@igrigorik
igrigorik / links.md
Created August 28, 2012 16:53
HAR Show links & resources
@majek
majek / udp_server.py
Created February 8, 2012 00:48
Simple python udp server
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)
@nstielau
nstielau / send_metric_to_statsd.sh
Created May 11, 2011 16:41
Send a metric to StatsD from bash
# 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.