Skip to content

Instantly share code, notes, and snippets.

View kjelly's full-sized avatar

Kuo-tung Kao kjelly

View GitHub Profile
@kjelly
kjelly / save_exception_to_file.py
Last active August 20, 2017 13:48
Save exception to file
import traceback
def f2():
raise Exception("S")
def f1():
f2()
@kjelly
kjelly / 社群活動中使用的詞的數量
Created July 15, 2017 10:23
台灣社群資料分析
$ wc *.txt|awk '{print $1 " " $4}'
429 Clojure_Taiwan.txt
1135 Docker_Taipei.txt
110 ElasticSearch_Taipei.txt
1467 Functional_Thursday.txt
376 Lisp_Taiwan.txt
680 Meteor_Taipei.txt
100 OpenStack_Taiwan_User_Group.txt
1167 PyLadies_Taiwan.txt
3082 Python_Hsinchu_User_Group.txt
@kjelly
kjelly / asyncio_sample_code.py
Created April 27, 2017 15:44
useful async io sample code
import asyncio
from concurrent.futures import ThreadPoolExecutor
import random
import time
io_pool_exc = ThreadPoolExecutor()
async def openfile(name):
sleep_time = random.randint(1, 5)
CapsLock & 1::return
CapsLock & 2::return
CapsLock & 3::return
CapsLock & 4::return
CapsLock & 5::return
CapsLock & 6::return
CapsLock & 7::return
CapsLock & 8::return
CapsLock & 9::return
CapsLock & 0::return
@kjelly
kjelly / kolla-kube-quickstart
Last active July 5, 2017 18:58
kolla-kube-quickstart
kubectl label node minikube kolla_controller=true
kubectl label node minikube kolla_compute=true
kubectl create namespace kolla
tools/kolla-ansible genconfig
~/stash_config.sh push
crudini --set /etc/kolla/nova-compute/nova.conf libvirt virt_type qemu
sed -i '/\[global\]/a osd pool default size = 1\nosd pool default min size = 1\n' /etc/kolla/ceph*/ceph.conf
../kolla-kubernetes/tools/fix-mitaka-config.py
../kolla-kubernetes/tools/secret-generator.py create
@kjelly
kjelly / command
Last active September 23, 2016 17:20
touchegg config for elementary os
dconf load /org/gnome/
@kjelly
kjelly / a.py
Created December 20, 2015 13:31
kiloeyes test code
# -*- coding: utf-8 -*-
# Copyright 2014 Hewlett-Packard
# Copyright 2015 Carnegie Mellon University
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@kjelly
kjelly / gist:1fa1fea52bc39c05a9ad
Created November 27, 2015 01:31
commit id: 12975e55042c0fc94fa38de84fba62f0ff068c17 , ubuntu-source, ansible 1.9.4, Docker version 1.8.2, build 0a8c2e3, all in one
sudo: unable to resolve host vagrant-ubuntu-trusty-64
INFO:__main__:Kolla config strategy set to: COPY_ONCE
INFO:__main__:Loading config file at /var/lib/kolla/config_files/config.json
INFO:__main__:Validating config file
INFO:__main__:Copying service configuration files
INFO:__main__:Removing existing destination: /etc/neutron/neutron.conf
INFO:__main__:Copying /var/lib/kolla/config_files/neutron.conf to /etc/neutron/neutron.conf
INFO:__main__:Setting permissions for /etc/neutron/neutron.conf
INFO:__main__:Removing existing destination: /etc/neutron/plugins/ml2/ml2_conf.ini
INFO:__main__:Copying /var/lib/kolla/config_files/ml2_conf.ini to /etc/neutron/plugins/ml2/ml2_conf.ini
@kjelly
kjelly / gist:873d67ef7decf902e48f
Created September 8, 2015 02:05
kolla global.yml
---
# You can use this file to override _any_ variable throughout Kolla.
# Additional options can be found in the 'kolla/group_vars/all.yml' file.
###################
# Kolla options
###################
# Valid options are [ COPY_ONCE, COPY_ALWAYS ]
#config_strategy: "COPY_ONCE"
@kjelly
kjelly / solution.md
Last active August 29, 2015 14:26
List the solutions for cinder bug/1477625

Bug title:

DB access to show volumes may not be properly controlled. https://bugs.launchpad.net/cinder/+bug/1477625

Bug description:

In volume.get, to get volume admin metadata, it added admin role to normal user. So anyone can get any volume information if he know volume id.