Skip to content

Instantly share code, notes, and snippets.

View miclovich's full-sized avatar
😇
Working, what else?

Victor miclovich

😇
Working, what else?
View GitHub Profile
@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 25, 2024 01:51
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 November 14, 2024 19:13
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 November 13, 2023 08:40
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?

@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time