Skip to content

Instantly share code, notes, and snippets.

View hantoine's full-sized avatar

Antoine Hebert hantoine

View GitHub Profile
@hantoine
hantoine / argo-in-kind.md
Last active July 11, 2022 13:44 — forked from darpr/argo-in-kind.md
"Argo Workflow" in `kind` Cluster

Argo in Kind

Play with "Argo Workflow" in your local kind cluster.

Prerequisites

The following instructions were tested in macOS Monterey (12.4), on 10 Jul 2022.

Docker Runtime

Ensure docker is installed and running.

K8s Client

@hantoine
hantoine / tensorboard_in_kaggle_notebook.py
Last active May 13, 2024 17:11
Launch TensorBoard in a Kaggle notebook and create a tunnel with ngrok to access it
from urllib.request import urlopen
from io import BytesIO
from zipfile import ZipFile
from subprocess import Popen
from os import chmod
from os.path import isfile
import json
import time
import psutil
@ivan3bx
ivan3bx / graceful_httpserver.go
Created September 20, 2017 05:32
Example of handling graceful shutdowns with gin-gonic
// runServer will start the HTTPServer, handling graceful
// shutdown on receives SIGTERM / SIGINT, returning nil.
//
// - returns error if the server can not start
// - returns error if the server panics in a way that isn't
// otherwise handled by gin
// - no errors otherwise
func runServer(addr string, r *gin.Engine) error {
s := &http.Server{
Addr: addr,
@smithclay
smithclay / weird-lambda-binaries-recipe.md
Created July 28, 2017 02:59
Recipe for Getting Strange Binaries Running in AWS Lambda

Recipe for running strange binaries in AWS Lambda

In general, the command ldd and the environment variable LD_LINKER_PATH is your best friend when running new, untested binaries in Lambda. My process (which I want to get around to automating one day, maybe using Packer), goes like this:

  1. Run an EC2 instance with the official AWS Lambda AMI.
  2. Get binary you want to run in AWS Lambda running on the instance (either by installing from a package manager or compiling). 
  3. Run ldd -v ./the-binary. Note all of the shared libraries it requires. You’ll need to remember these.
  4. Copy the binary to your local machine. Upload the binary with your AWS Lambda function code that runs the ldd command inside the handler function using the process execution library from your language of choice. In node, this works just fine: console.log(require('child_process').execSync('ldd -v ./the-binary'))
  5. Note any shared libraries that are missing in the function output. Copy those over from the EC2 instance to a direct
@sloria
sloria / bobp-python.md
Last active November 14, 2024 15:01
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@ducin
ducin / console.py
Last active January 1, 2022 16:41
Python script opening interactive console with current interpreter state. Thanks to readline/rlcompleter, you may use up/down arrows (history browse) or left/right arrows (line edition), see http://stackoverflow.com/questions/19754458/python-open-interactive-console-from-script)
"""
Console module provide `copen` method for opening interactive python shell in
the runtime.
"""
import code
import readline
import rlcompleter
def copen(_globals, _locals):
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"