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 / mm_get_posts.md
Last active December 21, 2022 08:28
get posts from mattermost postgres database

get posts from mattermost postgres database

connect database

docker exec -it gitlab gitlab-psql -d mattermost_production

show table schema

@kyokuheki
kyokuheki / esxi_trial_reset.sh
Last active August 30, 2025 17:57
ESXi trial reset
rm -r /etc/vmware/license.cfg
cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg
/etc/init.d/vpxa restart
vim-cmd vimsvc/license --show | grep expirationDate
# see https://calvin.me/reset-esxi-evaluation-license/
@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}"
@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 / 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 / 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 / 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
--- /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 / .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