Skip to content

Instantly share code, notes, and snippets.

# ubuntu22.04 on WSL of Win11
cd
sudo apt-get update
PKGS="python3-pip\
libgl1-mesa-glx\
libxkbcommon-x11-0\
libxcb-icccm4\
@hrkt
hrkt / enable_sudo_by_touch_id.sh
Last active January 19, 2022 07:28
A shell script to enable sudo by "Touch ID" on macOS
#!/bin/sh
# A shell script to enable sudo by "Touch ID" on macOS
# tested on macOS 11.6 Big Sur
TARGET_FILE=/etc/pam.d/sudo
# skip if it is not run on macOS
if [ 'Darwin' != `uname` ]; then
echo "not on macOS platform. exit."
exit 0
fi
@hrkt
hrkt / test-value.json
Created March 18, 2020 19:09
test-value json
{
"key1": 1
"key2": 2
}
@hrkt
hrkt / list_processes_in_screen.sh
Last active February 18, 2020 19:35
list processes in screen sessions
#!/bin/sh
screen -list | head -n -2 | tail -n +2 | cut -f1 -d'.' | cut -f2 | xargs -n 1 pstree -p | grep "^screen"
@hrkt
hrkt / install_node_12_centos.sh
Created February 13, 2020 21:26
install_node_12_centos.sh
#!/bin/bash
# https://github.com/nodesource/distributions/blob/master/README.md#rpm
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs
@hrkt
hrkt / gist:8169201a089364c1b7a763fbd04d30ac
Created February 13, 2020 20:54
install_docker_latest_on_centos.sh
#!/bin/bash
https://docs.docker.com/install/linux/docker-ce/centos/
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
# screenrc
#
# see also
#
# arch linux wiki
# https://wiki.archlinux.org/index.php/GNU_Screen
# GNU Screen manual
# https://www.gnu.org/software/screen/manual/screen.html#Overview
# scroll buffer (press Ctrl-J esc to enter copy-mode, press ESC to leave copy-mode)
@hrkt
hrkt / gist:ae4eb1b7a6203407e7598c18e03be0be
Created July 1, 2019 21:07
Add to Gootle Bookmark(bookmarklet)
javascript:(function(){var a=window;b=document;c=encodeURIComponent;s=a.parent.screen;d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"_b1","width="+.8*s.width+",height="+.8*s.height+",resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},100)})();
1. disable
```
$ sudo nvram SystemAudioVolume=%80
```
2. enable
```
$ sudo nvram-d SystemAudioVolume
```
@hrkt
hrkt / cleanup_rish.sh
Created February 27, 2015 15:35
Try rhino-shell as login shell
#!/bin/sh -x
rm -rf /opt/rhino
sed -i -e "s/\/opt\/rhino\/rish//g" /etc/shells