Skip to content

Instantly share code, notes, and snippets.

@stek29
stek29 / pivot_root_example.c
Created April 13, 2024 18:22
example on how to use pivot_root, and demonstration of fd's still being valid after pivot
#define _GNU_SOURCE
#include <sys/syscall.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sched.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
@stek29
stek29 / 0dnstest.go
Created April 3, 2024 14:17
dnstest -- query dns from different source ports range to debug network card losing packets from specific 5tuples
package main
import (
"flag"
"fmt"
"net"
"sync"
"github.com/miekg/dns"
)
@stek29
stek29 / optobw.sh
Created December 20, 2022 23:05
restore folder structure in Bitwarden after migrating from 1Password
#!/usr/bin/env bash
set -euo pipefail
# Step 0: Log in
if ! op whoami >/dev/null 2>/dev/null; then
eval "$(op signin)"
fi
if [ "$(bw status | jq -r .status)" != "unlocked" ]; then
@stek29
stek29 / k8sint.go
Created June 11, 2022 03:01
decode kubernetes internal etcd encoding to YAMLs
package main
import (
"fmt"
"io/ioutil"
"os"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/runtime/serializer/json"
@stek29
stek29 / twauth.py
Created June 11, 2022 02:57
twitter oob ouath python3
#!/usr/bin/env python
"""
requirements.txt:
certifi==2021.10.8
charset-normalizer==2.0.12
httplib2==0.20.4
idna==3.3
oauth2==1.9.0.post1
oauthlib==3.2.0
pyparsing==3.0.8
@stek29
stek29 / kube-apiserver-args.yaml
Created May 22, 2022 00:19
kube apiserver nginx http balancing poc
- command:
- kube-apiserver
- --bind-address=127.0.1.1
- --requestheader-allowed-names=front-proxy-client
- --requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt
- --requestheader-extra-headers-prefix=X-Remote-Extra-
- --requestheader-group-headers=X-Remote-Group
- --requestheader-username-headers=X-Remote-User
- --secure-port=6443
- ... more args ...
do shell script "diskutil mount disk0s3"
tell application "System Events"
tell application "System Preferences"
set current pane to pane id "com.apple.preference.startupdisk"
activate
delay 1
end tell
tell application process "System Preferences"
@stek29
stek29 / 0webosbrew-letsencrypt-ca.md
Last active April 1, 2024 00:23
fix webOS ca certificates for DST Root X3 expiry (on rooted TVs)

HowTo

  • Root via rootmy.tv
  • Install

Tested on webOS 4.5, should at least on webOS 3.5+

Installation/Update

curl -qs "https://gist.githubusercontent.com/stek29/761232c6f7e1ffbc36b98da2a3a0f4d9/raw/install.sh?$(date +%s)" | sh -
@stek29
stek29 / quine.swift
Created October 6, 2021 00:25
simple Quine program ¯\_(ツ)_/¯
func quine() {
var s = """
func quine() {
var s = MEGIC
let slash = "\\\\"
let s1 = "\\n "
let s2 = "\\"\\"\\""
var sInd = s.replacingOccurrences(of: "\\n", with: s1)
sInd = sInd.replacingOccurrences(of: slash, with: slash + slash)
sInd = s2 + s1 + sInd + s1 + s2
@stek29
stek29 / kpms.nginx
Last active October 6, 2021 11:23
kpms msx http based api hack for older webOS devices - for LE root cert expiry workaround
server {
listen 80;
server_name kp.local;
location = /msx/start.json {
proxy_pass https://kpms.cc;
proxy_http_version 1.1;
proxy_set_header Host "kpms.cc";