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
#!/usr/bin/env node | |
const { readFileSync } = require('fs'); | |
function messageHeader(item) { | |
const { user, ts, replies, user_profile } = item; | |
const name = user_profile?.display_name | |
|| user_profile?.real_name | |
|| user_profile?.name | |
|| user; | |
return { name, user, ts, replies }; |
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 -e | |
git grep "$@" $(git rev-list --all) |
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
# https://github.com/openresty/lua-resty-dns | |
lua_shared_dict ADDRESS 1m; | |
server { | |
listen 1234 default_server; | |
location / { | |
set $upstream ""; | |
rewrite_by_lua_block { | |
local ADDRESS = ngx.shared.ADDRESS |
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/bash | |
CURRENT_BRANCH=$(git branch --show-current) | |
BRANCHES=$(git branch --format="%(refname:short) %(upstream:track)" | grep "\[gone\]" | awk '{ print $1 }' | grep -v $CURRENT_BRANCH) | |
[[ -n "$BRANCHES" ]] && git branch -D $BRANCHES |
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/bash | |
MSYS_NO_PATHCONV=1 $(cygpath.exe $LOCALAPPDATA)/SourceTree/app-*/tools/putty/plink.exe [email protected] |
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
import digitalio | |
import board | |
import usb_hid | |
import rotaryio | |
from adafruit_hid.consumer_control import ConsumerControl | |
from adafruit_hid.consumer_control_code import ConsumerControlCode | |
consumer_control = ConsumerControl(usb_hid.devices) | |
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
import board | |
from digitalio import DigitalInOut, Pull | |
import usb_hid | |
from adafruit_hid.keyboard import Keyboard | |
from adafruit_hid.keyboard_layout_us import KeyboardLayout | |
kbd = Keyboard(usb_hid.devices) | |
layout = KeyboardLayout(kbd) | |
class Button: |
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
# https://learn.adafruit.com/adafruit-macropad-rp2040/macropad-basics | |
# https://docs.circuitpython.org/projects/macropad/en/latest/index.html | |
# https://docs.circuitpython.org/projects/hid/en/latest/api.html | |
import time | |
import usb_hid | |
from adafruit_macropad import MacroPad | |
from adafruit_hid.consumer_control import ConsumerControl | |
from adafruit_hid.consumer_control_code import ConsumerControlCode | |
from adafruit_hid.keyboard import Keyboard |
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/bash | |
sudo apt update | |
sudo apt upgrade -y | |
# Enable systemd | |
echo -e "[boot]\nsystemd=true\n" | sudo tee /etc/wsl.conf > /dev/null | |
# Install Nodejs | |
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs |
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
#!/usr/bin/env node | |
// eth0とdocker0がコンフリクトすると docker run によるコンテナが異常になる | |
// eth0とbr-xxxxがコンフリクトすると docker compose によるコンテナが異常になる | |
const { execSync } = require('child_process'); | |
function ipAddr () { | |
if (process.env.NODE_ENV === 'test') { | |
return [ | |
'inet 172.17.53.125/20 brd 172.17.63.255 scope global eth0', |
NewerOlder