Skip to content

Instantly share code, notes, and snippets.

View yuanying's full-sized avatar
🌴
On vacation

O. Yuanying yuanying

🌴
On vacation
View GitHub Profile
@yuanying
yuanying / use-label-selector-requirement.go
Last active June 19, 2020 03:07
LabelSelectorRequirement
cms := &v1.ConfigMapList{}
requirement, err := labels.NewRequirement(
apis.LabelKey,
selection.Exists,
nil,
)
if err != nil {
return nil, err
}
ls := labels.NewSelector().Add(*requirement)
@yuanying
yuanying / ca.rb
Created January 8, 2020 10:00
Generate x509 certs using Ruby
require 'openssl'
OpenSSL::Random.seed File.read('/dev/random', 16)
root_key = OpenSSL::PKey::RSA.new 2048 # the CA's public/private key
root_ca = OpenSSL::X509::Certificate.new
root_ca.version = 2 # cf. RFC 5280 - to make it a "v3" certificate
root_ca.serial = 1
root_ca.subject = OpenSSL::X509::Name.parse "/CN=kube-ca"
root_ca.issuer = root_ca.subject # root CA's are "self-signed"
@yuanying
yuanying / bryton-410-fit-amender.py
Created October 11, 2018 00:09
Fix fit file for Bryton Rider 410
#!/usr/bin/python
#
# Fit to TCX
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
Thu Aug 9 07:14:52 UTC 2018
@yuanying
yuanying / kubeadm-init.log
Created March 14, 2018 07:29
kubeadm init log
root@ubuntu-master01:/home/ubuntu# kubeadm init
[init] Using Kubernetes version: v1.9.4
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks.
[WARNING FileExisting-crictl]: crictl not found in system path
[certificates] Generated ca certificate and key.
[certificates] Generated apiserver certificate and key.
[certificates] apiserver serving cert is signed for DNS names [ubuntu-master01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 172.18.10.84]
[certificates] Generated apiserver-kubelet-client certificate and key.
[certificates] Generated sa key and public key.
@yuanying
yuanying / sa-learn
Created February 4, 2018 03:50
sa-learn
sa-learn -D --ham /var/mail/fraction.jp/yuanying/.Junk.negative --dbpath /var/mail-state/lib-amavis/.spamassassin
sa-learn -D --spam /var/mail/fraction.jp/yuanying/.Junk.positive --dbpath /var/mail-state/lib-amavis/.spamassassin
@yuanying
yuanying / kubectl-run-with-pvc.sh
Last active January 26, 2024 13:58
kubectl run with PVCs
#!/bin/bash
IMAGE="gcr.io/google-containers/ubuntu-slim:0.14"
COMMAND="/bin/bash"
SUFFIX=$(date +%s | shasum | base64 | fold -w 10 | head -1 | tr '[:upper:]' '[:lower:]')
usage_exit() {
echo "Usage: $0 [-c command] [-i image] PVC ..." 1>&2
exit 1
}
@yuanying
yuanying / neutron-policy-summary.py
Last active January 18, 2018 23:59
Research of OpenStack policies
import openpyxl as px
import re
import os
import sys
import json
output = 'neutron-policy.xlsx'
translation_dict = {
'create': '作成',
@yuanying
yuanying / node111.yaml
Last active June 5, 2018 07:13
coreos nodes userdata
#cloud-config
---
# Before commit any change please validate this file @ https://coreos.com/validate/
# Set hostname
hostname: node111
# Set SSH Key
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0ol7jQ4umQMrE1qtXnyeYk/23g6zVJyVPh0+rljElu/7zj6iJZtixxs+LebPH6mZP13RIGPP0GlrSXRVBj9F2pjb/Y/PMyHBq3+BMeiYhn6XmNMwtTK2O69vvFZQi0M3wTVSezP9OxxrPay+eCXkGVi8lnh6ZDMrvSKI2c5SQ7wFJfT/4XTxzcP2gsotRV0rzADie1EF4MYke+ZJuiwnrFbZpeogrNtSvivR4f/g0/fD8NOjCKgbk4uY//6YhEqNaGhm0wABKt0MtimmxLLe2kosoFS539t88y5tD4ispcxlOAtVKZEL1ogf0VRrcBWSTfIiJty5vw6aRTfoFwuzZ ootsuka@mxs.nes.nec.co.jp