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 / vagrant-kvm.md
Last active May 16, 2025 14:51
How to use vagrant-kvm

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

@yuanying
yuanying / kubectl-run-with-pvc.sh
Last active April 22, 2025 18:17
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 / Install.md
Last active February 28, 2025 22:12
Setup uvtool

Install

Host side

Setup bridge

$ sudo su -
# apt-get update
# apt-get remove network-manager

apt-get install bridge-utils

@yuanying
yuanying / sync-garmin-connect-to-runkeeper.rb
Created May 7, 2012 07:33
Syncronize from Garmin Connect activity to Runkeeper
#!/usr/bin/env ruby -wKU
# Syncronize from Garmin Connect to Runkeeper
require 'rubygems'
require 'runkeeper'
require 'rss/1.0'
require 'rss/2.0'
require 'rss/dublincore'
require 'open-uri'
require 'uri'
require 'cgi'
@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,
@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 / create-dev-env-magnum.md
Last active March 11, 2019 09:16
Develop Magnum with Devstack

Develop Magnum with Devstack

Vagrant

I'm using vagrant (parallels on Mac) to boot a devstack. Vagrantfile is below. Devstack IP Address is 192.168.11.197.

Vagrant.configure('2') do |config|

config.vm.box = "trusty64"

Thu Aug 9 07:14:52 UTC 2018