Skip to content

Instantly share code, notes, and snippets.

View kokoye2007's full-sized avatar

kokoye2007 kokoye2007

View GitHub Profile
@kokoye2007
kokoye2007 / ky.sh
Created August 17, 2022 14:04 — forked from clux/ky.sh
kubectl get yaml without managedFields
# kubectl < 1.21
ky() {
local -r resource="${1:-$(kubectl api-resources --no-headers | choose 0 | fzf)}"
local -r name="${2:-$(kubectl get ${resource} --no-headers | choose 0 | fzf)}"
kubectl get "${resource}" "${name}" -oyaml \
| yq 'del(.metadata.managedFields)' -y \
| bat -l=yaml --plain --theme=DarkNeon
}
# kubectl >= 1.21
@kokoye2007
kokoye2007 / tmate_for_ssh.md
Last active July 25, 2021 05:45 — forked from brett-schneider/tmate_for_ssh.md
Ubuntu(systemd) tmate service for ssh

The motivation is: reverse ssh to remote computer, the only thing needed is that the remote is connected to the Internet.

  1. On 18.04 or older remote, get tmate, put it in /usr/local/bin (20.04 is 2.4.0 but has issues /w -F [tmate-io/tmate#204]):
curl -L https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz|tar xJv
sudo mv tmate-2.4.0-static-linux-amd/tmate /usr/local/bin
  1. Put public keys in ~/.ssh/authorized_keys
@kokoye2007
kokoye2007 / ubuntu-xenial-armfh-qemu.md
Created July 17, 2021 02:28 — forked from takeshixx/ubuntu-xenial-armfh-qemu.md
Running Ubuntu 16.04.1 armhf on Qemu

Running Ubuntu 16.04.1 armhf on Qemu

This is a writeup about how to install Ubuntu 16.04.1 Xenial Xerus for the 32-bit hard-float ARMv7 (armhf) architecture on a Qemu VM via Ubuntu netboot.

The setup will create a Ubuntu VM with LPAE extensions (generic-lpae) enabled. However, this writeup should also work for non-LPAE (generic) kernels.

The performance of the resulting VM is quite good, and it allows VMs with >1G ram (compared to 256M on versatilepb and 1G on versatile-a9/versatile-a15). It also supports virtio disks whereas versatile-a9/versatile-a15 only support SD cards via the -sd argument.

Get netboot files

@kokoye2007
kokoye2007 / thai-id-card.py
Created July 16, 2021 13:54 — forked from bouroo/thai-id-card.py
Thai National ID Card reader in python
#!/usr/bin/env python
# bouroo<[email protected]>
# 07.04.2019
# sudo apt-get -y install pcscd python-pyscard python-pil
import binascii
import io
import os
import sys
from PIL import Image
@kokoye2007
kokoye2007 / build.sh
Created April 18, 2019 17:07 — forked from Forst/build.sh
Ubuntu ISO with preseed.cfg generation script
#!/bin/bash
## FORSTWOOF UBUNTU PRESEED :: BUILD SCRIPT
# Quit on first error
set -e
# Temporary directory for the build
TMP="/var/tmp/ubuntu-build"
@kokoye2007
kokoye2007 / git-clearHistory
Last active March 26, 2019 18:37 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
@kokoye2007
kokoye2007 / git-tag-remove-rename
Created March 8, 2019 18:05 — forked from danielestevez/gist:2044589
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
[server]
SERVER
[server:vars]
server_name=SERVER
docker_nginx_ssl=true
@kokoye2007
kokoye2007 / create-docker-droplet.sh
Created February 3, 2019 10:30 — forked from christianberg/create-docker-droplet.sh
Shell script to create a Digital Ocean Droplet and install docker
#!/bin/bash
set -e
SECRETFILE=~/.digitalocean
if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then
if [ -e $SECRETFILE ]; then
. $SECRETFILE
fi
fi
@kokoye2007
kokoye2007 / mysql_secure.sh
Created January 19, 2019 14:04 — forked from Mins/mysql_secure.sh
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10