Skip to content

Instantly share code, notes, and snippets.

View mkfsn's full-sized avatar
🇯🇵
Working from Tokyo

Peiming Wu mkfsn

🇯🇵
Working from Tokyo
View GitHub Profile
@mkfsn
mkfsn / ref.go
Created December 26, 2021 09:19
Go Generics Reference function to any type
// https://go.dev/play/p/Yrwl1kVfvXi?v=gotip
package main
import (
"fmt"
"time"
)
type Ptr[T any] interface {
*T
@mkfsn
mkfsn / kubernetes.fish
Created December 30, 2020 05:59
Kubernetes Fish Shell Customizations
# https://medium.com/better-programming/4-simple-kubernetes-terminal-customizations-to-boost-your-productivity-deda60a19924
# Using theme bobthefish: https://github.com/oh-my-fish/theme-bobthefish
set -g theme_display_k8s_context yes
set -g theme_display_k8s_namespace yes
alias k='kubectl'
function ksn
if test (count $argv) -lt 1; or test $argv[1] = "--help"

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

from pyquery import PyQuery as pq
import requests
users = {}
resp = requests.get("https://github.com/tokyo-metropolitan-gov/covid19/pull/1055")
for i in pq(resp.text).find("a.author[data-hovercard-type="+'"user"'+"]"):
user = pq(i).text()
url = pq(i).attr('href')
if user not in users:
r = requests.get('https://api.github.com/users'+url).json()
package main
import (
"flag"
"net"
"strings"
"github.com/miekg/dns"
)
package main
import (
"fmt"
)
type 被質詢者 interface {
回答(問題 string) string
}
@mkfsn
mkfsn / jpn_year.go
Last active April 2, 2019 09:11
西暦→和暦変換
package main
import (
"errors"
"fmt"
"time"
)
var (
asiaTokyo *time.Location
#!/usr/bin/env python3.7
import platform
print('hello world')
print("I'm using python", platform.python_version())
package main
import (
"fmt"
"log"
"os/exec"
"sync"
"os"
"flag"
"os/signal"
@mkfsn
mkfsn / caddy
Created April 7, 2018 05:31 — forked from sebastianmarkow/caddy
caddy web server openrc startup script
#!/sbin/openrc-run
description="Caddy web server"
description_reload="Reload configuration"
extra_started_commands="reload"
: ${CADDY_CONF:=/etc/caddy/Caddyfile}
: ${CADDY_PIDFILE:=/var/run/caddy.pid}
: ${CADDY_USER:=caddy}