Skip to content

Instantly share code, notes, and snippets.

View netj's full-sized avatar

Jaeho Shin netj

View GitHub Profile
@netj
netj / 🎨=github.com.1h.sh
Last active April 22, 2023 18:50
macOS xbar menu item for GitHub Pull Requests/Issues
#!/usr/bin/env bash
# macOS xbar menu item for GitHub Pull Requests/Issues
#
# <xbar.title>GitHub assigned Pull Requests and Issues</xbar.title>
# <xbar.version>v2023.16.0</xbar.version>
# <xbar.author>Jaeho Shin</xbar.author>
# <xbar.author.github>netj</xbar.author.github>
# <xbar.desc>Quick handle for showing number of assigned Github Pull Requests / Issues and giving access to the most recent ones</xbar.desc>
# <xbar.image>https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png</xbar.image>
# <xbar.abouturl>https://gist.github.com/netj/082aa1d431db0e240eb492f0a3f16873</xbar.abouturl>
@netj
netj / gcp-start-iap-tunnel-ssh-proxy-magic.sh
Last active July 30, 2024 13:39
a nifty script for accessing with native SSH your IAP allowed Compute Engine instances
#!/usr/bin/env bash
# ~/.ssh/gcp-start-iap-tunnel-ssh-proxy-magic.sh
# a script to be used as SSH ProxyCommand to allow fully functional SSH access to any Google Cloud Compute Engine VMs allowing IAP access
#
# Author: Jaeho Shin <[email protected]>
# Created: 2022-10-31
# See also:
# - https://gist.github.com/netj/df4f9de1fefd254ab11979be7035b5d0/#readme
# - https://cloud.google.com/iap/docs/using-tcp-forwarding
#
@netj
netj / .zprofile
Last active July 25, 2022 22:45
zprofile for using latest bash instead of zsh
# ~/.zprofile for launching login shells to latest bash from Homebrew on macOS
# Origin: https://gist.github.com/netj/f76dffced1995a10a4c455d8418ed47d
#
# If you still have old bash (3.x) as your shell, please change it to zsh before using this with:
# chsh -s /bin/zsh
[ -n "${INTELLIJ_ENVIRONMENT_READER-}" ] || # to not interfere with PyCharm or IntelliJ IDEs
PATH="/opt/homebrew/bin:$PATH" exec env -u SHELL bash -il
#!/usr/bin/env bash
# yeshup -- wraps given command with a parent process that sends SIGTERM upon receiving SIGHUP, the opposite of nohup
# See also: https://github.com/RhysU/yeshup
set -eu
pid=$$
trap 'kill -TERM $pid' HUP
"$@" & pid=$!
wait
@netj
netj / mysqlToJson.py
Last active August 11, 2021 23:11 — forked from quickbreach/mysqlToJson.py
Convert mysqldump to JSON, optional upload to elastic
import re
import csv
import json
import sys
import requests
from requests.auth import HTTPBasicAuth
import hashlib
'''
Usage: 'python3 mysqlToJson.py <targetFile.sql>
@netj
netj / aws-ssm-ssh-proxy-magic.sh
Last active July 1, 2021 04:52
a nifty script for ssh'ing into any AWS SSM-enabled EC2 instance with no extra manual setup
#!/usr/bin/env bash
# ~/.ssh/aws-ssm-ssh-proxy-magic.sh -- a nifty script for ssh'ing into any AWS SSM-enabled EC2 instance with no extra manual setup
#
# Author: Jaeho Shin <[email protected]>
# Created: 2021-02-01
# See also:
# - https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html
# - https://gist.github.com/d9006a823163d7662d8ff105c9a49e0e
#
# 1. Copy this script to ~/.ssh/aws-ssm-ssh-proxy-magic.sh
#!/usr/bin/env bash
# a Day One CLI for macOS script generator for importing diary entries from Momento3 text exports
#
# Prerequisites:
#
# - install dayone2 CLI
# - brew install coreutils
#
#
# Usage: run the script inside a Momento Export (one text file per day format)
#!/usr/bin/env bash
#
# <bitbar.title>BluetoothConnector</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Jaeho Shin</bitbar.author>
# <bitbar.author.github>netj</bitbar.author.github>
# <bitbar.desc>Quick handle for showing whether a Bluetooth device is connected or not and quickly connecting/disconnecting it</bitbar.desc>
# <bitbar.image>http://icons.iconarchive.com/icons/bokehlicia/captiva/256/bluetooth-icon.png</bitbar.image>
# find bluetooth device name from filename
@netj
netj / Enby Code R.css
Created March 11, 2019 08:22
a Blink Shell Font
@font-face {
font-family: "Envy Code R";
font-style: normal;
font-weight: normal;
src: url(data:font/opentype;charset-utf-8;base64,T1RUTwALAIAAAwAwQ0ZGIEFt83wAABB4AAHV7UZGVE1cbC2QAAHwwAAAABxHREVGArsABAAB5mgAAAAgT1MvMuc/K8kAAAEgAAAAYGNtYXBAlmy5AAAIoAAAB7ZoZWFk/f3CSgAAALwAAAA2aGhlYQvHBLUAAAD0AAAAJGhtdHj133xSAAHmiAAACjhtYXhwAo5QAAAAARgAAAAGbmFtZcZfgEgAAAGAAAAHIHBvc3T/NgBnAAAQWAAAACAAAQAAAAAUOTjh3h1fDzz1AAsIAAAAAADNQbHgAAAAAM1BseD/xP1OBJgIBgAAAAgAAgAAAAAAAAABAAAHaP4mAAAETP/E/7QEmAABAAAAAAAAAAAAAAAAAAACjgAAUAACjgAAAAMETAGQAAUAAADNAM0AAAEfAM0AzQAAAR8AZgIACAQCAAUJAAAAAgAEoAAAr0AAePsAAAAAAAAAAEVOVlkAQAAg+wYFjv4mAAAHaAHaIAAAk83UAAAEUgWOACAAIAABAAAAHgFuAAEAAAAAAAAASgCWAAEAAAAAAAEAGQEVAAEAAAAAAAIABwE/AAEAAAAAAAMAKgGdAAEAAAAAAAQAGQH8AAEAAAAAAAUADQIyAAEAAAAAAAYAFQJsAAEAAAAAAAcAOAL0AAEAAAAAAAgAGQNhAAEAAAAAAAkADAOVAAEAAAAAAAoASgQ4AAEAAAAAAAsAGQS3AAEAAAAAAAwAFgT/AAEAAAAAABAAGQVKAAEAAAAAABIAGQWYAAMAAQQJAAAAlAAAAAMAAQQJAAEAMgDhAAMAAQQJAAIADgEvAAMAAQQJAAMAVAFHAAMAAQQJAAQAMgHIAAMAAQQJAAUAGgIWAAMAAQQJAAYAKgJAAAMAAQQJAAcAcAKCAAMAA
#!/usr/bin/env bash
# rename-audio-files.sh -- prints a shell script to rename .m4a, .mp3 files according to its tags
#
# Why/where would anyone use this:
# My car's USB audio (iDrive) works much better if the files are named with their metadata than the terse names (track-title) given by iTunes.
#
# Author: Jaeho Shin <[email protected]>
# Created: 2019-03-10
set -euo pipefail