Skip to content

Instantly share code, notes, and snippets.

View mikoim's full-sized avatar

Eshin Kunishima mikoim

View GitHub Profile
@mikoim
mikoim / with-footprints-filter.js
Created December 24, 2023 17:15
卒業したwithのスクリプト群 足あとフィルター(年齢・住所), プロフィール文を選択可能にする
// ==UserScript==
// @name with 足あとフィルター
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://with.is/mypages/footprints
// @match https://with.is/mypages/footprints?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=with.is
// @grant none
@mikoim
mikoim / demo.py
Created October 17, 2021 19:05
Retrieve Ethereum address from private key with web3.py
from web3.auto import w3
from eth_account.messages import encode_defunct
message = encode_defunct(text='')
signed_message = w3.eth.account.sign_message(message, private_key='0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80') # Hardhat
address = w3.eth.account.recover_message(message, signature=signed_message.signature)
print(address)
@mikoim
mikoim / gist:4fca4b4ce75de2ab9d3a8277be60812e
Created January 11, 2021 17:41
mastodon 3.3.0 sidekiq memory profiling
Total allocated: 898218489 bytes (8619312 objects)
Total retained: 51743915 bytes (371827 objects)
allocated memory by gem
-----------------------------------
108927024 activerecord-5.2.4.4
106709156 other
104717077 bootsnap-1.5.1
80443139 http-4.4.1
71043385 addressable-2.7.0
@mikoim
mikoim / ssh_config
Last active November 23, 2020 15:33
Hardened OpenSSH_8.3p1 settings
# OpenSSH_8.3p1, OpenSSL 1.1.1g FIPS 21 Apr 2020
# HashKnownHosts yes
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
# github.com currently has not supported Ed25519.
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group16-sha512
[foobar@sushi zfs]$ make -j1
GEN gitrev
make all-recursive
make[1]: Entering directory '/home/foobar/src/zfs'
Making all in include
make[2]: Entering directory '/home/foobar/src/zfs/include'
Making all in sys
make[3]: Entering directory '/home/foobar/src/zfs/include/sys'
Making all in fm
make[4]: Entering directory '/home/foobar/src/zfs/include/sys/fm'
@mikoim
mikoim / Sennheiser_MOMENTUM_True_Wireless_2_Linux.md
Last active October 26, 2023 15:18
Sennheiser MOMENTUM True Wireless 2 on Linux with BlueZ 5 and PulseAudio

Sennheiser MOMENTUM True Wireless 2 on Linux with BlueZ 5 and PulseAudio

Unfortunately, it does not work as out of box. After applying following workarounds, finally, it works.

  • Fedora 32 x86_64
  • Linux kernel 5.7.10 vanilla
  • PulseAudio 13.99 + pulseaudio-module-bluetooth-freeworld (for proprietary codecs aptX)
  • BlueZ 5.54

😱🙀😱🙀😱

@mikoim
mikoim / daemon.conf
Last active November 30, 2020 01:20
SONY TA-ZH1ES, Kernel 5.8.18-200.fc32.x86_64, pulseaudio 13.99.1-rebootstrapped
# ~/.config/pulse/daemon.conf
default-sample-format = float32le
default-sample-rate = 96000
avoid-resampling = yes
resample-method = soxr-vhq
# default-sample-rate = 384000
# -> unstable, sometimes pulseaudio could not play sound.
@mikoim
mikoim / firefox-inside-docker.md
Last active January 9, 2020 10:22
How to avoid "Bus error (core dumped)" when you run Firefox inside Docker container

I met "Bus error (core dumped)" when I run Firefox with Selenium to capture screenshot of web sites.

firefox -headless -screenshot https://developer.mozilla.com
*** You are running in headless mode.
ExceptionHandler::GenerateDump cloned child ExceptionHandler::WaitForContinueSignal waiting for continue signal...
1218
ExceptionHandler::SendContinueSignalToChild sent continue signal to child
Unable to init server: Could not connect: Connection refused
Bus error (core dumped)
@mikoim
mikoim / build.log
Created November 9, 2019 14:59
Clear Linux OS 31530
Mock Version: 1.4.21
ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/python2-marisa.spec'], chrootPath='/var/lib/mock/clear-python2-marisa/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8', 'CCACHE_DIR': '/var/tmp/ccache', 'CCACHE_UMASK': '002'}shell=Falselogger=<mockbuild.trace_decorator.getLog object at 0x7f6fbee291d0>timeout=0uid=1000gid=1000user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.qvk0c2d8:/etc/resolv.conf']unshare_net=TrueprintOutput=False)
Using nspawn with args ['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.qvk0c2d8:/etc/resolv.conf']
Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '1e54c0d33e0241f59c19218ab916c646', '-D', '/var/lib/mock/clear-python2-marisa/root', '-a', '--capa
@mikoim
mikoim / README.md
Last active November 27, 2023 09:22
WireGuard example configuration for VPN

Server

iptables -A FORWARD -i wg0 -o YOUR_INTERFACE -s 10.200.200.0/24 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o YOUR_INTERFACE -s 10.200.200.0/24 -j MASQUERADE

systemd-networkd

see vpn.netdev and vpn.network.