Skip to content

Instantly share code, notes, and snippets.

View miclovich's full-sized avatar
😇
Semper fidelis

Victor miclovich

😇
Semper fidelis
View GitHub Profile
@asheroto
asheroto / README.md
Last active October 8, 2025 01:08
Easily install and configure GeoIP for use with iptables which enables you to block/allow entire countries.

Configure GeoIP for iptables

Important

This setup forces iptables-legacy (not nftables) and installs a custom-built xt_geoip_query tool written in C to properly read modern GeoIP databases (xtables-addons ≥ 3.20). The script does not modify firewall rules automatically; it only echoes recommended examples.

Caution

If you use Docker or containerized services, switching to iptables-legacy can temporarily break container networking. This happens because Docker manages its own NAT and MASQUERADE rules, which can be lost when iptables backends change or modules are reloaded. SEE NOTES BELOW.

@nnja
nnja / .pdbrc
Created August 2, 2019 12:55
My .pdbrc file with an interacti alias
# Install IPython: python3 -m pip install ipython
import IPython
from traitlets.config import get_config
cfg = get_config()
cfg.InteractiveShellEmbed.colors = "Linux" # syntax highlighting
cfg.InteractiveShellEmbed.confirm_exit = False
alias interacti IPython.embed(config=cfg)
@pirate
pirate / docker-compose-backup.sh
Last active October 9, 2025 12:11
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@bvaughn
bvaughn / index.md
Last active September 8, 2025 00:55
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.

@saisandeep
saisandeep / sliding-window-counters-redis.py
Last active September 12, 2019 13:00
Sliding Window Counters Redis Rate Limiter
import time
import redis
# redis connection
def get_connection(host="127.0.0.1", port="6379", db=0):
connection = redis.StrictRedis(host=host, port=port, db=db)
return connection
class SlidingWindowCounterRateLimiter(object):
@swalkinshaw
swalkinshaw / tutorial.md
Last active July 20, 2025 07:39
Designing a GraphQL API
@davestewart
davestewart / 0. notes.md
Last active August 11, 2020 16:16
Vue JS local storage plugin. Hydrates modules from local storage on load, and saves state on each commit
@devshahani
devshahani / gist:f660ef959da0878d1072bfdfefada139
Last active July 11, 2018 01:54
Polaris primaryAction example
class MyReactComponent extends Component {
constructor(props) {
super(props);
this.myTestFunction = this.myTestFunction.bind(this);
}
myTestFunction(){
alert("hello")
}
render() {
return (
@simonw
simonw / recover_source_code.md
Last active September 14, 2025 04:26
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@indiesquidge
indiesquidge / pull_request_template.md
Last active October 19, 2025 06:32
An example PR template
Status Type Env Vars Change Review App Ticket
Ready/Hold Feature/Bug/Tooling/Refactor/Hotfix Yes/No Link Link

⚠️ NOTE: use notes like this to emphasize something about the PR. This could include other PRs this PR is built on top of; new or removed environment variables; reasons for why the PR is on hold; or anything else you would like to draw attention to.

Problem

What problem are you trying to solve?