Skip to content

Instantly share code, notes, and snippets.

View yunginnanet's full-sized avatar
🧮
learning how to use email

kayos yunginnanet

🧮
learning how to use email
View GitHub Profile
#!/usr/bin/env bash
function _getArchiveName() {
_ext="$(echo "$@" | awk -F '.' '{print $NF}')"
_name="${*/.$_ext//}"
_name="${_name/\//}"
echo "$_name"
}
function _x() {
#!/usr/bin/env bash
# snag: colorize, bat, apt-file, apt-fast, toilet
alias aget='sudo apt-get install'
alias qaget='sudo apt-fast -y install'
alias aremove='sudo apt-get remove'
alias apurge='sudo apt-get purge'
alias ashow="_ashow"
#!/usr/bin/env bash
# example output:
# cleaning duplicate netfilter rules...
# updating netfilter rules...
# updating iptables...
# latest: SHA256 (-) = e32144dcf88d333d2ecfbce61fc2392045c462b3370093b70bd5429c3ae9e922
# current: SHA256 (-) = e32144dcf88d333d2ecfbce61fc2392045c462b3370093b70bd5429c3ae9e922
# backing up old rules...
@yunginnanet
yunginnanet / fwd55.go
Last active January 6, 2024 03:56
fwd55.go
package main
// ▄─▄ ▄ ▄ ▄ ──▄ ▄─▄ ▄─▄
// ▓─ ▓ ▓ ▓ ▓ ▓ ▀─▄ ▀─▄
// ▀ ▀─▀─▀ ──▀ ▀─▀ ▀─▀
// f w d --> 5 5
//
// simple rfc1928 proxy server
//
//
@yunginnanet
yunginnanet / relocate.sh
Last active August 29, 2023 02:42
carefully move directory to diff location and then create symlink in original location to new location
#!/usr/bin/env bash
# included shebang for completeness but likely you'd wanna tack this onto a profile or bashrc, something that gets sourced by your shell
function isDir() {
if [ -d "$1" ]; then return 0; else
echo "$1 is not a directory, bail"
return 1
fi
}
@yunginnanet
yunginnanet / docker.sh
Last active March 10, 2023 06:42
install docker on ubuntu one liner
apt-get update; apt-get -y full-upgrade; apt-get -y install git curl wget ca-certificates curl gnupg lsb-release; mkdir -m 0755 -p /etc/apt/keyrings && rm /etc/apt/keyrings/docker.gpg; curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && apt-get -y update && apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; docker run hello-world
#!/usr/bin/env bash
_port=${LXD_PORT:-"8443"}
_fqdn=${LXD_FQDN:-"ebaumsworld.com"}
set -e
function req {
go version || return 1
git version || return 1
ssh -V || return 1
}
req || exit 1
while :; do data="$(sensors | grep Tctl | awk '{print $2}' | tr -d '+' | awk -F '.' '{print $1}')"; case $data in 4[0-9]) col="blue" ;; 5[0-9]) col="green" ;; 5[0-9]) col="green" ;; 6[0-9]) col="yellow" ;; 7[0-9]) col="red" ;; 8[0-9]) col="red" ;; 9[0-9]) col="red" ;; *) col="white" ;; esac ; out="$(echo "$data°C" | toilet -f fig.mono12 | colorize $col/black --attr bold)"; clear; echo "$out"; sleep 0.5; done
@yunginnanet
yunginnanet / getBaud.go
Last active December 12, 2022 00:01
get current baud rate of tty/serial device in linux via ioctl syscall
package main
import (
"os"
"strconv"
"golang.org/x/sys/unix"
)
func getBaudRate(name string) (int, error) {
{
"name": "GitHub Go Search",
"description": "Add Golang GitHub results to your search engines",
"version": "0.1",
"manifest_version": 2,
"icons": {
"20": "icon.svg",
"48": "icon.svg",
"96": "icon.svg"