Skip to content

Instantly share code, notes, and snippets.

@tetsuyainfra
tetsuyainfra / mingw.sh
Created January 9, 2023 17:33 — forked from jeroen/mingw.sh
mingw-w64 cross compile
# We use Ubuntu 14.04 to build a native gcc for win32 with multilib support
#
# Based on:
# http://sourceforge.net/p/mingw-w64/wiki2/Native%20Win64%20compiler/
# http://sourceforge.net/p/mingw-w64/code/HEAD/tree/stable/v3.x/mingw-w64-doc/howto-build/mingw-w64-howto-build.txt?format=raw
#
# Cross compiling notes:
# - The minor version of gcc must match that of our cross compiler (4.8 in this case)
# - Important parameters: http://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html
#
@tetsuyainfra
tetsuyainfra / gist:31f8663a1a59fd56ef2e53c6a981c52e
Created January 8, 2023 11:25
switchbot Plug mini AdvertisementData
import asyncio
from pprint import pprint as pp
from bleak import BleakScanner
from bleak.backends.scanner import AdvertisementData
async def main():
print("scanning for 5 seconds, please wait...")
devices = await BleakScanner.discover(return_adv=True)
@tetsuyainfra
tetsuyainfra / .wslconfig
Last active January 6, 2023 13:30
zcat /proc/config.gz Linux 5.15.79.1-microsoft-standard-WSL2+ #2 SMP Fri Jan 6 21:39:44 JST 2023 x86_64 x86_64 x86_64 GNU/Linux
[wsl2]
kernel=C:\\tmp\\wsl2-kernel\\vmlinux
memory=2GB
@tetsuyainfra
tetsuyainfra / application_system_test_case
Last active December 31, 2017 02:43
Rails5.1 SystemTest with Chromium Headless mode ref: https://qiita.com/tetsuyainfra/items/b504510ea9110765e07c
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w(no-sandbox headless disable-gpu window-size=1280x800)
}
)
driven_by :selenium, using: :chrome,
@tetsuyainfra
tetsuyainfra / post.rb
Last active March 5, 2019 05:32
ActiveAdminでPOSTパラメータを加工してUpdateするメモ ref: https://qiita.com/tetsuyainfra/items/390652f179f329779f9d
ActiveAdmin.register Post do
permit_params :uid, :name, :meta, :related_ids
form do |f|
f.semantic_errors # shows errors on :base
f.inputs do
f.input :uid
f.input :name
f.input :meta, as: :text # json,jsonb型をtextとして扱う
f.input :related_uids, as: :string # arrayをstringとして扱う
@tetsuyainfra
tetsuyainfra / gist:e16b34a4bd6b9556adb61f39a67a71d9
Last active September 15, 2017 08:13
KVMでbridge専用でethernet使う時のメモ
# ブリッジ作成
nmcli con add type bridge ifname br1
nmcli con modify bridge-br1 bridge.stp no
IP 割り振らずにできないのかなぁ
nmcli con modify bridge-br1 ipv4.method manual
# 物理デバイスをブリッジに追加
@tetsuyainfra
tetsuyainfra / dhcpd.conf
Created September 7, 2017 06:38
DNS権威サーバーとキャッシュサーバが同居してて、isc-dhcpdでDDNSするときの覚書 ref: http://qiita.com/tetsuyainfra/items/0980e3fedf31c228e907
ddns-updates on;
ddns-update-style interim;
update-static-leases on;
subnet 10.0.100.0 netmask 255.255.255.0 {
zone stg.home.local. {
primary 127.0.0.2; ← ここ
key DHCP_UPDATER;
}
zone 100.0.10.in-addr.arpa. {
@tetsuyainfra
tetsuyainfra / file0.txt
Created September 5, 2017 11:51
KeeAgent(KeePass) + ssh.exe(start-ssh-pageant.cmd)の覚書 ref: http://qiita.com/tetsuyainfra/items/715deba28ec4ef353af6
λ set SSH_AUTH_SOCK=/tmp/.ssh-pageant-username
λ start-ssh-pageant.cmd
# 起動してる!
λ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
9196 1 9196 9196 ? 197609 20:37:02 /usr/bin/ssh-pageant
# 実行 or キーの確認
λ ssh hogehoge -vvv
@tetsuyainfra
tetsuyainfra / gist:6a89d1153c0d1c21638a57bf5be3db71
Created August 23, 2017 05:22
virtio-rngのちょっとしたメモ
# RNG@乱数ジェネレーターのメモ
Host:
- Hostではhavegedやrng-toolsを使って乱数を生成して、virtio-rng経由でGuestに渡す
- rngd(TPM,DRNG) or haveged(Software) -> /dev/random -> (qemu-kvm) -> Guestへ
Guest:
- Guestではrng-toolsを使って/dev/hwrngから乱数を生成して/dev/randomに書き込む
- rng-tools(/dev/hwrng) -> /dev/random
@tetsuyainfra
tetsuyainfra / boot.cfg
Created June 22, 2017 06:24
ESXi USBブート+kickstartする場合のサンプル
bootstate=0
title=Loading ESXi installer
timeout=5
kernel=/tboot.b00
kernelopt=runweasel noIOMMU ks=usb text nofb com2_baud=115200 com2_Port=0x2f8 tty2Port=com2 gdbPort=none logPort=none
modules=/b.b00 --- /jumpstrt.gz --- /useropts.gz --- /features.gz --- /k.b00 --- /chardevs.b00 --- /a.b00 --- /user.b00 --- /uc_intel.b00 --- /uc_amd.b00 --- /sb.v00 --- /s.v00 --- /ata_liba.v00 --- /ata_pata.v00 --- /ata_pata.v01 --- /ata_pata.v02 --- /ata_pata.v03 --- /ata_pata.v04 --- /ata_pata.v05 --- /ata_pata.v06 --- /ata_pata.v07 --- /block_cc.v00 --- /char_ran.v00 --- /ehci_ehc.v00 --- /elxnet.v00 --- /hid_hid.v00 --- /i40en.v00 --- /igbn.v00 --- /ima_qla4.v00 --- /ipmi_ipm.v00 --- /ipmi_ipm.v01 --- /ipmi_ipm.v02 --- /ixgben.v00 --- /lpfc.v00 --- /lsi_mr3.v00 --- /lsi_msgp.v00 --- /lsi_msgp.v01 --- /misc_cni.v00 --- /misc_dri.v00 --- /mtip32xx.v00 --- /ne1000.v00 --- /nenic.v00 --- /net_bnx2.v00 --- /net_bnx2.v01 --- /net_cdc_.v00 --- /net_cnic.v00 --- /net_e100.v00 --- /net_e100.v01 --- /net_enic.v00 --- /net_fcoe.v0