Skip to content

Instantly share code, notes, and snippets.

View hidakatsuya's full-sized avatar
🏡
Working from home

Katsuya HIDAKA hidakatsuya

🏡
Working from home
View GitHub Profile
@hidakatsuya
hidakatsuya / getent.md
Created April 14, 2024 09:14
getent - get entries from administrative database, such as passwd and group
getent passwd
root:x:0:0 ...
...
getent passwd root
root:x:0:0 ...
@hidakatsuya
hidakatsuya / accesses-a-url-every-second.sh
Last active April 14, 2024 09:15
A script that accesses a URL every second
url=http://<url>
while true; do TZ=JST-9 date; curl $url; sleep 1s; done
@hidakatsuya
hidakatsuya / localectl.md
Last active March 20, 2024 05:02
Show current settings of the system locale
$ localectl status
   System Locale: LANG=en_US.UTF-8
                  LANGUAGE=en_US:en
       VC Keymap: us
      X11 Layout: us
       X11 Model: pc105
@hidakatsuya
hidakatsuya / bash_aliases
Last active March 17, 2024 13:14
An alias for nvim command to launch nvim with a directory
# Prerequistes
# * OS is Ubuntu 22.04
# * Nvim is installed with AppImage
# Usage
# nvim /path/to/your/project/directory
function nvim() {
path=$1
if [ -d "$path" ]; then
cd $path
@hidakatsuya
hidakatsuya / main.md
Last active January 15, 2024 00:52
Open the GitHub repository for the current branch
@hidakatsuya
hidakatsuya / README.md
Last active November 20, 2023 15:12
Kotlin Flow

Kotlin Flow について

flow.kt

run2() の結果

1+2=3
2+4=6
3+6=9
@hidakatsuya
hidakatsuya / get-absolute-path-of-file.md
Created November 8, 2023 07:24
Get absolute path of file
realpath path/to/file
@hidakatsuya
hidakatsuya / gradle-cheat-sheet.md
Last active November 3, 2023 11:58
Gradle Cheat Sheet
@hidakatsuya
hidakatsuya / main.md
Last active January 3, 2024 05:23
Generate alphanumeric random chars
ruby -rsecurerandom -e "puts SecureRandom.alphanumeric(16)" | pbcopy
ruby -rsecurerandom -e "puts SecureRandom.random_number(10000)" | pbcopy
@hidakatsuya
hidakatsuya / ruby-run-e-httpd.md
Created May 17, 2023 13:55
ruby -run -e httpd
$ gem i webrick
$ ruby -run -e httpd -- --port 8000 .
[2023-05-17 22:52:46] INFO  WEBrick 1.8.1
[2023-05-17 22:52:46] INFO  ruby 3.2.1 (2023-02-08) [x86_64-linux]
[2023-05-17 22:52:46] INFO  WEBrick::HTTPServer#start: pid=70048 port=8000
[2023-05-17 22:52:46] INFO  To access this server, open this URL in a browser:
[2023-05-17 22:52:46] INFO http://127.0.0.1:8000