Skip to content

Instantly share code, notes, and snippets.

@PinkD
PinkD / proxy_venv.sh
Created July 8, 2023 10:13
setup a netns and connect to host network with veth
#!/bin/bash
netns=proxy
veth=veth-proxy
host_addr="172.16.233.1/24"
ns_addr="172.16.233.2/24"
user=$(whoami)
help() {
@TomFaulkner
TomFaulkner / Python Patch Parent.py
Created July 24, 2018 20:38
Patch the parents of a class for unit testing
# source: https://stackoverflow.com/a/24577389/9893423
# The MockFoo class still has the methods of the Foo class and it doesn't
# have the methods defined in the parent because the parent is now a Mock class.
from contextlib import contextmanager
@contextmanager
def patch_parent(class_):
"""
Mock the bases
@npat-efault
npat-efault / append_test.go
Last active October 21, 2016 06:54
Append consecutive slices, on same underlying array
package tstappend
import "testing"
const N = 8192
func appendBytes(a, b []byte) []byte {
if len(b) == 0 {
return a
}
@Bekbolatov
Bekbolatov / tmux.md
Last active March 7, 2024 01:18
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@semenko
semenko / dmidecode
Last active October 26, 2021 02:57
Dell XPS 13 2015 model 9343 on Ubuntu 15.04, dmidecode, lsusb, lspci
$ sudo dmidecode
# dmidecode 2.12
# SMBIOS entry point at 0x000f0000
SMBIOS 2.8 present.
<SNIP>
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@rxaviers
rxaviers / gist:7360908
Last active May 10, 2024 23:34
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
package main
// Restorer holds a function that can be used
// to restore some previous state.
type Restorer func()
// Restore restores some previous state.
func (r Restorer) Restore() {
r()
}
@jpetazzo
jpetazzo / README.md
Last active August 21, 2019 17:55
Give network superpowers to docker

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Note: I recommend to use https://github.com/jpetazzo/pipework instead.

  • pipework is a better name than unionize
  • it's hosted on a "real" github repo instead of a small gist :-)

Now if you want Unionize, it's still here. Just check those examples.

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 10, 2024 16:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname