Skip to content

Instantly share code, notes, and snippets.

View leoh0's full-sized avatar
🕶️
Working

Eohyung Lee leoh0

🕶️
Working
View GitHub Profile
@leoh0
leoh0 / masq.sh
Created September 13, 2021 16:17 — forked from mowings/masq.sh
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done
@leoh0
leoh0 / kubectl-root-in-host-nopriv.pks.sh
Created May 6, 2021 05:06 — forked from jjo/kubectl-root-in-host-nopriv.sh
Yeah. Get a root shell at any Kubernetes *node* via `privileged: true` + `nsenter` sauce. PodSecurityPolicy will save us. DenyExecOnPrivileged didn't (kubectl-root-in-host-nopriv.sh exploits it)
#!/bin/sh
# Launch a Pod ab-using a hostPath mount to land on a Kubernetes node cluster as root
# without requiring `privileged: true`, in particular can abuse `DenyExecOnPrivileged`
# admission controller.
# Pod command in turn runs a privileged container using node's /var/run/docker.sock.
#
# Tweaked for PKS nodes, which run their docker stuff from different
# /var/vcap/... paths
node=${1}
case "${node}" in
@leoh0
leoh0 / Dell XPS 15 9560 Manjaro Setup instructions
Created March 20, 2019 08:41 — forked from meirbon/Dell XPS 15 9560 Manjaro Setup instructions
Small, quick guide to set up Manjaro on the XPS 15 9560
# 1. First of all of course get Manjaro:
https://manjaro.org/get-manjaro/
# I recommend using Etcher to copy the image to your USB:
https://etcher.io/
# 2. Before installing make sure:
# - Secure boot is disabled in BIOS
# - Your SSD, HDD or NVME drive is set to AHCI instead of RAID
# - Fastboot should be on Auto or minimal, but this shouldn't matter to much
@leoh0
leoh0 / upload-github-release-asset.sh
Created July 24, 2018 03:56 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
#!/bin/sh
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
cat /dev/urandom | LC_CTYPE=C tr -dc A-Za-z0-9_ | head -c ${l}
echo
}
genpasswd "$@"
@leoh0
leoh0 / knife.sh
Last active August 29, 2015 13:56 — forked from nukemberg/knife.sh
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab:
# Author: Avishai Ish-Shalom <avishai@fewbytes.com>
SED=sed
# first argument set the command level
_get_knife_completions() {
n=$1
shift
# first argument is knife, so shift it
# TODO throwing error:
# Cannot find a resource for to_ary on ubuntu version 12.04
require 'set'
file "/root/chef_resources-#{node.name}.json" do
resource_clxn = Chef::ResourceCollection.new
run_context.resource_collection.each do |r|
next if r.class.to_s == 'Chef::Resource::NodeMetadata'
r = r.dup