Skip to content

Instantly share code, notes, and snippets.

View r10r's full-sized avatar

Ruben Jenster r10r

  • Drachenfels GmbH
  • Pforzheim
View GitHub Profile
@r10r
r10r / runc_with_tty.md
Created October 7, 2021 07:03 — forked from jzaccone/runc_with_tty.md
Start runC container with TTY Device

About

recvtty is a reference implementation of a consumer of runC's --console-socket API. It is automatically built when doing a make on the runc project.

Prereq

These instructions were tested on Ubuntu 16.04. Also go, git are required.

Install runC

go get github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc
#!/usr/bin/env python
import httplib
import sys
from xml.etree import ElementTree
wireserver_ip = '168.63.129.16'
wireserver_conn = httplib.HTTPConnection(wireserver_ip)
print('Retrieving goal state from the Wireserver')
@r10r
r10r / postgres_recovery.md
Last active August 19, 2021 06:07 — forked from supix/postgres_recovery.md
Postgres error: Missing chunk 0 for toast value in pg_toast

References

https://newbiedba.wordpress.com/2015/07/07/postgresql-missing-chunk-0-for-toast-value-in-pg_toast/

The problem

In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.

One of the symptoms of such corruptions is the following message:

@r10r
r10r / jq-cheetsheet.md
Created July 7, 2021 13:53 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@r10r
r10r / http_capture.go
Created July 5, 2021 08:28
Capture HTTP packets using github.com/google/gopacket
package main
import (
"github.com/google/gopacket"
//"github.com/google/gopacket/layers"
"flag"
"fmt"
"github.com/google/gopacket/pcap"
)
@r10r
r10r / one-liners.md
Last active June 18, 2021 12:18
One liner shell commands.
  • Remove comments and empty lines grep -v '^[[:space:]]*#' | tr -s '\n'
@r10r
r10r / proxyshell.sh
Last active June 15, 2021 07:34
Load environment variables into a subshell, change prompt and append history
#!/bin/sh
proxyshell() {
if [ -n "$PROXYSHELL" ]; then
echo "already using proxyshell environment"
return 2
fi
history -a # append history
echo "using proxyshell environment"
/bin/bash --init-file <(echo "export PROXYSHELL=true; [ -f ~/.bashrc ] && . ~/.bashrc; . /etc/profile.d/http_proxy.sh_; history -n") -i
@r10r
r10r / vimrc.local
Last active May 4, 2021 13:00
My vim config file
" location of this file
" global (debian): /etc/vim/vimrc.local
" user: ~/.vimrc
" Avoid that defaults overwrite custom configuration
" see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837761
" run ':scriptnames' to show the import order
let skip_defaults_vim=1
source $VIMRUNTIME/defaults.vim
@r10r
r10r / regexp-quote.go
Last active April 15, 2021 07:12
Regexp quote stdin
package main
import (
"bufio"
"io"
"os"
"regexp"
)
func main() {
@r10r
r10r / lxc-hooks.go
Created April 8, 2021 08:21
lxc hooks environment
type HookType string
const (
HookPreStart HookType = "pre-start"
HookPreMount = "pre-mount"
HookAutodev = "autodev"
HookStartHost = "start-host"
HookStart = "start"
HookStop = "stop"
HookPostStop = "post-stop"