Skip to content

Instantly share code, notes, and snippets.

Avatar

Keith Kim keithkim

View GitHub Profile
@keithkim
keithkim / merge_mp3.sh
Last active January 2, 2022 00:05
simple script to automate merging converted mp3 files into single mp3 and add cover image
View merge_mp3.sh
#!/usr/bin/bash
# Keith Kim, 2021-06
# This is to automate merging mp3 files and add cover image for audible audio book files converted to mp3 using AAXtoMP3
OIFS="$IFS"
IFS=$'\n'
for authorpath in `find . -maxdepth 1 -type d -print`
do
if [ "." == "$authorpath" ]; then continue; fi
View now
#!/bin/bash
# https://askubuntu.com/questions/1020692/terminal-splash-screen-with-weather-calendar-time-sysinfo
#
# NAME: now
# PATH: $HOME/bin
# DESC: Display current weather, calendar and time
# CALL: Called from terminal or ~/.bashrc
# DATE: Apr 6, 2017. Modified: May 24, 2019.
View docker-compose-kafka.yml
version: '2'
services:
zookeeper:
container_name: zookeeper
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
build: .
container_name: kafka
@keithkim
keithkim / multimon-output.html
Created August 27, 2020 19:19
APC UPS CGI outputs
View multimon-output.html
Content-Type: text/html; charset=utf-8
Content-Language: en
Pragma: no-cache
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Multimon: UPS Status Page</title>
View .color
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
@keithkim
keithkim / update_python_package_via_pip.txt
Created February 13, 2018 23:19
Update Python package using pip
View update_python_package_via_pip.txt
# Windows
for /F "delims===" %i in ('pip freeze -l') do pip install -U %i
# or,
for /F "delims= " %i in ('pip list --outdated') do pip install -U %i
# Linux
sudo -H pip install pipdate
sudo -H pipdate
# or,
pip list --outdated --format=legacy | awk '{print $1;}' | xargs -n1 pip install -U
@keithkim
keithkim / colortest.bat
Created January 20, 2018 22:54
Colors in cmd console or batch file for Windows
View colortest.bat
REM ### credit: https://stackoverflow.com/users/4544905/nick-n-chicago
REM ### from: https://stackoverflow.com/questions/2048509/how-to-echo-with-different-colors-in-the-windows-command-line/8920789
@echo off
cls && color 08
rem .... the following line creates a [DEL] [ASCII 8] [Backspace] character to use later
rem .... All this to remove [:]
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (set "DEL=%%a")
View Liberal Regex Pattern for Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@keithkim
keithkim / .screenrc
Created March 13, 2013 01:45
Linux screen configuration (.screenrc). Instead of ^C, use ^O. And use ^K for copy mode.
View .screenrc
shell -$SHELL
startup_message off
defscrollback 5000
shelltitle "$ |bash"
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
# caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= %c"
activity "%c activity -> %n%f %t"
caption always "%{= Wk}%-w%{= Bw}%n %t%{-}%+w %-="
term screen-256color
View .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
. ~/.color