Skip to content

Instantly share code, notes, and snippets.

View troglobit's full-sized avatar
🎯
Focusing

Joachim Wiberg troglobit

🎯
Focusing
View GitHub Profile
@fnky
fnky / ANSI.md
Last active May 26, 2024 08:58
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@umohi
umohi / download-github-artifact
Created September 21, 2018 22:48
use curl to download release artifact from github private repository
# in order to download release artifacts from github, you have to first retreive the
# list of asset URLs using the github repo REST API. Use the asset URL to download
# the artifact as a octet-stream data stream. You will need to get an access token
# from "settings -> developer settings -> personal access tokens" on the github UI
#!/bin/bash -e
owner="MY_ORG_NAME"
repo="MY_REPO_NAME"
tag="ARTIFACT_TAG"
artifact="ARTIFACT_NAME"

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.

@wkz
wkz / sniff.sh
Created April 28, 2018 15:02
Mirror a set of interfaces to a sniffer interface, ignoring 802.1Q tag information.
#/!bin/sh
# usage: sniff.sh <interface> [<interface>...]
# create a dummy to mirror all traffic to
ip link add dev sniffer type dummy
ip link set dev sniffer up
# intermediate dummy, needed because AF_PACKET-sockets gets the packet
# as seen before any tc-actions have been applied to it.
ip link add dev untag type dummy
@OndraZizka
OndraZizka / switchHeadphones.sh
Last active March 25, 2024 12:58
Bluetooth headset - switch between quality sound + no mic (A2DP) and crappy sound and mic (HSP/HFP)
#!/bin/bash
#### Restart Bluetooth
if [ "$1" == "resetBT" ] ; then
sudo rfkill block bluetooth && sleep 0.1 && sudo rfkill unblock bluetooth;
exit;
fi;
#### Toggle listen/speak
if [ "$1" == "" -o "$1" == "toggle" ] ; then
@mcastelino
mcastelino / tc mirroring.md
Last active December 11, 2023 02:16
Using tc redirect to connect a virtual machine to a container network

Connecting a veth device to tap

  • veth device from CNI/CNM plugin: eth0
  • tap device that connects to the VM: tap0

Redirecting traffic between the two devices

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev tap0
@wkz
wkz / lisp.c
Created October 21, 2017 22:13
/* {
* @t[0] = time();
* @reads[pid()] = quantize(arg2)
* }
*/
prog->ast =
node_expr("",
node_expr("=",
node_expr("[]",
node_ident("@t"),
@xentec
xentec / setup-cross-cc.sh
Last active October 21, 2023 12:20
Alpine Linux cross-compiler setup script
#!/bin/sh
CTARGET="$1"
if [ -z "$CTARGET" ]; then
program=$(basename $0)
echo "usage: $program TARGET_ARCH"
return 1
fi
# get abuild configurables
@jessfraz
jessfraz / proposal.md
Last active September 15, 2017 02:59

Self isolating binaries

This is a play proposal for a new wrapper around go build that would build your binary but wrap it in code that would prepare isolation around your binary on run.

A concept of this is in https://github.com/jfrazelle/binctr, in that it takes a docker image and embeds the contents into a final binary so you have a self-contained binary.

The binctr example is unnessesarily heavy for go binaries because all you need is a completely static binary.

@Lewiscowles1986
Lewiscowles1986 / rPi3-ap-setup.sh
Last active July 16, 2023 15:33
Raspberry Pi 3 access-point-setup
#!/bin/bash
#
# This version uses September 2017 august stretch image, please use this image
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi