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 July 1, 2025 23:55
Easily install and configure GeoIP for use with iptables which enables you to block/allow entire countries.

Configure GeoIP for iptables

This script configures GeoIP for use with iptables. Installs Linux headers, uses xtables-addons, uses latest db-ip.com database, fixes dependencies, loads xt_geoip module.

Supports colored message using ANSI escape codes. 😎

Run the script as root or with sudo.

Script Functionality

@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 June 25, 2025 17:55
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 June 16, 2025 15:19
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 June 6, 2025 19:24
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 28, 2024 08:10
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 August 30, 2024 19:57
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?