Skip to content

Instantly share code, notes, and snippets.

View milesrichardson's full-sized avatar
👁️
Miles Richardson

Miles Richardson milesrichardson

👁️
Miles Richardson
View GitHub Profile
@willurd
willurd / web-servers.md
Last active April 23, 2024 23:07
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
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 23, 2024 15:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@dpino
dpino / ns-inet.sh
Last active April 19, 2024 18:12
Setup a network namespace with Internet access
#!/usr/bin/env bash
# set -x
if [[ $EUID -ne 0 ]]; then
echo "You must be root to run this script"
exit 1
fi
# Returns all available interfaces, except "lo" and "veth*".
@hwdsl2
hwdsl2 / .MOVED.md
Last active April 18, 2024 01:37
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@zelig
zelig / p2ptesting.md
Last active March 1, 2024 12:46
p2p network similation, testing and monitoring framework
@colophonemes
colophonemes / create_triggers
Last active February 17, 2024 15:15
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
@bkuhl
bkuhl / .gitlab-ci.yml
Last active February 5, 2024 12:08
How to use docker-compose in GitLab CI
# Using edge-git ensures we're always pulling the latest
# You can lock into a specific version using the *-git tags
# on https://hub.docker.com/_/docker/
image: docker:edge-git
services:
- docker:dind
# If you only need compose in a specific step definitely put this
# only in that step so it's not executed unnecessarily
before_script:
@DerFichtl
DerFichtl / clamav-macosx.md
Last active January 2, 2024 22:34
clamav on mac osx - install and configure the virus scanner on mac osx
layout title published tags
post
clamav - install and configure on mac osx
true
blog
clamav

Install Clamav

Install clamav via homebrew