Skip to content

Instantly share code, notes, and snippets.

View kyontan's full-sized avatar
♨️

kyontan kyontan

♨️
View GitHub Profile
@kyontan
kyontan / deployment.yaml
Created June 19, 2021 16:24
Migrate existing WordPress to bitnami/wordpress-nginx
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: wordpress
name: blog
namespace: default
spec:
replicas: 1
selector:
@kyontan
kyontan / bash_profile.bash
Created June 10, 2021 09:52
envchain autocompletion (wip)
# not used, copied function body into _delegate
function _executables {
local exclude=$(compgen -abkA function | sort)
local executables=$(
comm -23 <(compgen -c) <(echo $exclude)
type -tP $( comm -12 <(compgen -c) <(echo $exclude) )
)
COMPREPLY=( $(compgen -W "$executables" -- ${COMP_WORDS[COMP_CWORD]}) )
}
@kyontan
kyontan / gp_latest_photo_url
Created May 9, 2021 08:44
GoPro interval photo taker (Hero5)
#!/bin/bash
tmpfile=$(mktemp)
while true; do
curl --silent http://10.5.5.9/gp/gpMediaList > $tmpfile
grep "busy" $tmpfile > /dev/null
if [ $? -eq 1 ]; then break; fi
sleep 1
done
@kyontan
kyontan / bpf.c
Created December 27, 2020 15:24
pyroute2 + SRv6 example
#include <linux/bpf.h>
int pass(struct __sk_buff *skb) {
return BPF_OK; // packet continues
// return BPF_DROP; // packet drops
}
@kyontan
kyontan / merge.sql
Last active July 26, 2020 15:20
BigQuery MERGE DML to merge {source} into {destination} with having same primary keys also having newer updated_at
MERGE {destination} T
USING (
SELECT * EXCEPT(rn)
FROM (
SELECT
*,
row_number() over (PARTITION BY {primary_keys} ORDER BY updated_at DESC) AS rn
FROM {source})
WHERE rn = 1
) S
@kyontan
kyontan / pamove
Created June 2, 2020 08:40
PulseAudio sink-output changer
#!/usr/bin/env ruby
class String
def to_i_first
self.match(/\d+/)[0].to_i
end
def unquote_str
self.match(/"(.*)"/)[1]
end
@kyontan
kyontan / keynote.scpt
Last active November 20, 2019 02:25 — forked from lambdamusic/keynote.scpt
Apple Keynote: export presenter notes
-- HOWTO:
-- after saving it, open with Script Editor (default) and run it
-- PREREQUISITES:
-- make sure your Keynote presentation is open in the background
set presenterNotes to ""
set slideNumber to 1
tell application "Keynote"
@kyontan
kyontan / lazy_product.rb
Created June 7, 2019 16:28
lazy edition of Enumerable.product
class LazyProduct
include Enumerable
def initialize(array)
@array = array
end
def self.from(array)
new(array)
end
@kyontan
kyontan / README.md
Last active April 14, 2019 15:47
Enabling ECDSA in PKCS#11 support for ssh-agent for OpenSSH 7.9p1 (ref: https://bugzilla.mindrot.org/show_bug.cgi?id=2474)
@kyontan
kyontan / docker-compose.yml
Created March 8, 2019 17:33
ICTSC2018 それはアクセスできないようにしたはずなのに…… 問題環境
version: '2'
services:
db:
container_name: database
image: mariadb:10.2.22
ports:
- "3306:3306"
volumes:
- ./db:/var/lib/mysql