This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const main = async () => { | |
try { | |
const ret = await new Promise(() => { | |
setTimeout(() => { | |
throw new Error('error in setTimeout'); | |
}, 1); | |
}); | |
console.log(`promise succeeded: ${ret}`); | |
} catch (err: unknown) { | |
console.error(`promise failed: ${err}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regexp Lookaround Memo | |
====================== | |
Lookahead | |
--------- | |
``` | |
❯ echo "hoge\nfuga\nhoge1\nfuga11\nhoge111\nfuga1111" | grep -P 'hoge(?=\d+)' | |
hoge1 | |
hoge111 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CN := test.x28.co | |
all: test.key test.crt | |
%.key: | |
openssl genrsa \ | |
-out $@ \ | |
2048 | |
%.crt: %.key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(myproc). | |
-include_lib("kernel/include/logger.hrl"). | |
-export([ | |
start_link/0 | |
]). | |
%% | |
%% {ok, Pid} = myproc:start_link() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface RandomGeneratorInterface | |
{ | |
public function getString(int $length): string; | |
public function getBytes(int $length): string; | |
} | |
class RandomFileReader implements RandomGeneratorInterface | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head -c 4 /dev/urandom | perl -Mfeature=say -ne 'say unpack("h*", $_);' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PKG := google-chrome-stable | |
DEB := $(PKG)_current_amd64.deb | |
all: $(DEB) | |
$(DEB): | |
curl -L https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o $@ | |
info: $(DEB) | |
dpkg -I $< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat input.xml | xmllint --format - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Reference: https://unix.stackexchange.com/questions/453069/configuring-kensington-slimblade-in-linux | |
# | |
# Kensington Slimblade Trackball Button IDs: | |
# | |
# .------+------. | |
# | 2 | 8 | | |
# | .--+--. | | |
# +---+ 4/5 +---+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list available outputs | |
xrandr | |
xrandr --query | |
# set HDMI-2 output as 3840x2160, to the left of eDP-1 | |
xrandr --output HDMI-2 --mode 3840x2160 --left-of eDP-1 | |
# set HDMI-2 output as 3840x2160, to mirror eDP-1 | |
xrandr --output HDMI-2 --mode 3840x2160 --same-as eDP-1 |
NewerOlder