Skip to content

Instantly share code, notes, and snippets.

@bavovna
bavovna / termination_state.txt
Created September 30, 2020 19:26
HAProxy termination_state
From https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.5
Session state at disconnection
TCP and HTTP logs provide a session termination indicator in the
"termination_state" field, just before the number of active connections. It is
2-characters long in TCP mode, and is extended to 4 characters in HTTP mode,
each of which has a special meaning :
- On the first character, a code reporting the first event which caused the
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@Darkless012
Darkless012 / delay_localhost.sh
Created May 9, 2017 16:14
Bash script that add simulation of delay on localhost and remove it on exit
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
set -e
function cleanup {
echo -e "${RED}Removing delay from localhost"
echo -e "-----------------------------${NC}"
sudo tc qdisc del dev lo root netem
sudo tc -s qdisc
@mdonkers
mdonkers / server.py
Last active July 22, 2024 13:51
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@jpgrace
jpgrace / git.migrate
Last active March 3, 2017 10:53 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@Cinderhaze
Cinderhaze / output
Created October 15, 2016 15:43
How to pretty-print hashes and arrays for puppet debugging
ubuntu@ubuntu:~$ puppet apply pretty.pp [12/46]
Notice: Scope(Class[main]): {one => 1, two => [dos, 2]}
Notice: Scope(Class[main]):
{
"one": "1",
"two": [
"dos",
"2"
]
}
@LadyNamedLaura
LadyNamedLaura / gitroot
Created February 18, 2016 10:57
gitroot, have git in your root.
#!/bin/sh
export GIT_WORK_TREE=/
if [[ "$1" == "autocommit" ]]
then
git status --porcelain | grep -v '^??' || exit 0
exec git commit -a -m 'autocommit'
fi
exec git $@
@vicegd
vicegd / index.html
Last active August 11, 2022 06:51
Reveal.JS - Tables
<section>
<h2>Tablas con información</h2>
<table>
<thead><tr>
<th>Ciudad</th>
<th>Año de fundación</th>
<th>Población</th>
</tr></thead>
<tbody><tr>
<td>Gijón</td>
@sulami
sulami / fix-webogram.js
Created August 16, 2015 11:31
Webogram Full-Width Userscript
// ==UserScript==
// @name Fix Webogram width
// @namespace webogram.fixes
// @match https://web.telegram.org/*
// @version 2
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;

Modifying an Existing Docker Image

To install a custom package or modify an existing docker image we need to

  1. run a docker a container from the image we wish to modify
  2. modify the docker container
  3. commit the changes to the container as a docker image
  4. test changes made to image

1.) Running a docker container from an image