Skip to content

Instantly share code, notes, and snippets.

View kyokuheki's full-sized avatar

Kenzo Okuda kyokuheki

  • NTT DOCOMO
  • Tokyo, Japan
View GitHub Profile
@kyokuheki
kyokuheki / ip2hex.py
Created March 22, 2018 02:37
hex static route for dhcp option 121
import re
# option 121 hex 00c0.a801.0117.c02f.a2c0.a801.0117.c02f.a4c0.a801.0118.c01a.5dc0.a801.0118.c0a8.00c0.a801.0118.ac10.00c0.a801.01
# hex2ip
s = "00c0.a800.0117.c02f.a2c0.a800.0117.c02f.a4c0.a800.0118.c0a8.00c0.a800.0118.ac10.00c0.a800.01"
s = s.replace(".", "")
l = [(i+j) for (i,j) in zip(s[::2],s[1::2])]
l = [(int(x, 16), x) for x in l]
for x,y in l: print("%s\t%s" % (x,y))
@kyokuheki
kyokuheki / stm.md
Last active June 9, 2025 10:33
STM/CTMに参加するときのあると良いもの

Shownet での持ち物とか

持ち物にはテプラや養生テープなどで名前をつけることをおすすめします。よく紛失します。

モノタロウの物品例を追加しました。似たものなら他のでもいいです。

【必須なもの】

  • ノートPC
    • IPv6 対応
  • VLAN 対応
@kyokuheki
kyokuheki / .aliases
Last active July 6, 2018 01:37
よく使うコマンド
alias getwip='/usr/bin/curl -sS httpbin.org/ip | jq .origin'
alias httbin='/usr/bin/wget httpbin.org/ip -qO-'
alias ping8='ping 8.8.8.8'
alias ping1='ping 1.1.1.1'
alias pingv68='ping6 2001:4860:4860::8888'
alias pingv61='ping6 2606:4700:4700::1111'
alias passwdgen='openssl passwd -1 -salt `openssl rand -base64 8`'
# mac
opendiff
--- /etc/chrony/chrony.conf.orig 2016-05-10 01:02:04.684764657 +0900
+++ /etc/chrony/chrony.conf 2016-05-10 01:08:58.000000000 +0900
@@ -17,11 +17,46 @@
# fails they will be discarded. Thus under some circumstances it is
# better to use IP numbers than host names.
-server 0.debian.pool.ntp.org offline minpoll 8
-server 1.debian.pool.ntp.org offline minpoll 8
-server 2.debian.pool.ntp.org offline minpoll 8
-server 3.debian.pool.ntp.org offline minpoll 8
@kyokuheki
kyokuheki / esxi.md
Last active August 9, 2018 03:46
esxi config command
esxcli network vswitch standard portgroup add -p "vlan 1096" -v vSwitch0
esxcli network vswitch standard portgroup set -p "vlan 1096" -v 1096

esxcli network ip interface remove -i vmk1
esxcli network ip interface add -i vmk1 -p "vlan 1096"

esxcli network ip interface ipv6 set -i vmk1 -I 10.0.163.2 -N 255.255.255.128 -t static
esxcli network ip route ipv4 add --gateway 10.0.163.1 -N defaultTcpipStack --network default
@kyokuheki
kyokuheki / docker_socket.md
Created April 8, 2019 05:35
docker socket
bastion ~ # docker run -ti --rm --name=curl --volume=/var/run/docker.sock:/var/run/docker.sock:rw docker sh
/ # apk --update add curl jq
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/6) Installing nghttp2-libs (1.35.1-r0)
(2/6) Installing libssh2 (1.8.2-r0)
(3/6) Installing libcurl (7.64.0-r1)
(4/6) Installing curl (7.64.0-r1)
@kyokuheki
kyokuheki / gitlab_password_reset.md
Last active August 15, 2019 04:11 — forked from dnozay/README.md
Collection of useful stuff for interacting with gitlab.

Reset root/admin password

Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.

# start the console
sudo gitlab-rails console
@kyokuheki
kyokuheki / start_ssh.ps
Last active April 17, 2019 01:42
SSHD on Windows 10
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Start-Service sshd
cp $env:windir\System32\OpenSSH\sshd_config_default $env:windir\System32\OpenSSH\sshd_config
notepad $env:windir\System32\OpenSSH\sshd_config
#
Restart-Service sshd
Set-Service sshd -StartupType Automatic
notepad $env:USERPROFILE\.ssh\authorized_keys
get-content "D:\home\kyokuheki\.ssh\authorized_keys" | add-content $env:USERPROFILE\.ssh\authorized_keys
@kyokuheki
kyokuheki / kubecon_curl.sh
Last active May 29, 2019 03:59 — forked from hobbsh/kubecon_curl.sh
Download Kubecon 2019 EU presentations from Sched
#!/bin/bash
DAYS=("2019-05-21" "2019-05-22" "2019-05-23" "2019-05-20")
SUBDOMAIN=kccnceu19
mkdir -p kubecon_files
for DAY in "${DAYS[@]}"; do
#Super shitty pipefest because of grep matched groups sadness
LINKS=($(curl https://${SUBDOMAIN}.sched.com/${DAY}/overview | grep -oEi "f='(.*)' cl" | cut -d\' -f 2 | tr '\n' ' '))
for LINK in "${LINKS[@]}"; do
echo "Requesting https://${SUBDOMAIN}.sched.com/${LINK}"