Skip to content

Instantly share code, notes, and snippets.

View yuuichi-fujioka's full-sized avatar

yuuichi fujioka yuuichi-fujioka

View GitHub Profile
@yuuichi-fujioka
yuuichi-fujioka / force_inject_port.sh
Created September 20, 2016 05:35
inject port to neutron
# tenant user
neutron port-create ${NET_NAME} --name my_port
# run on ovs-agent node
PORT_ADDR=$(...)
PORT_ID=$(neutron port-show my_port | awk '/ id /{print $4}')
PORT_MAC=$(neutron port-show my_port | awk '/ mac_address /{print $4}')
sudo ovs-vsctl add-port br-int injected_port -- set interface injected_port type=internal 'external_ids={attached-mac="'${PORT_MAC}'", iface-id="'${PORT_ID}'", iface-status=active}'
sudo ip link set up injected_port
@yuuichi-fujioka
yuuichi-fujioka / setup.py
Created August 8, 2016 01:46
Simple setup.py
from setuptools import setup
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='hoge',
version='0.1',
description='Hoge',
url='http://github.com/yuuichi.fujioka/hoge',
@yuuichi-fujioka
yuuichi-fujioka / local_settings.py
Last active July 25, 2016 02:10
openstack logging configuration file
# horizon
LOGGING = {
...
'formatters': {
...
'file': {
'format': '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s %(message)s'
},
},
@yuuichi-fujioka
yuuichi-fujioka / push_power_button.sh
Created May 10, 2016 05:37
emulate pushing a power button with adb shell.
adb shell input keyevent 26
@yuuichi-fujioka
yuuichi-fujioka / windows_install.xml
Created April 12, 2016 07:03
domain xml for install windows to kvm.
<domain type='kvm'>
<name>win</name>
<uuid>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</uuid>
<memory unit='MiB'>4096</memory>
<currentMemory unit='MiB'>4096</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64'>hvm</type>
</os>
<cpu mode='custom' match='exact'>
@yuuichi-fujioka
yuuichi-fujioka / dump.sh
Created February 25, 2016 05:07
mysqldump
docker run -ti --rm --link ${container_name}:mysql mariadb sh -c 'exec mysqldump -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" --all-databases'
#!/bin/bash
source ~/devstack/openrc admin admin
neutron net-create external --router:external=True --provider:network_type=local
neutron subnet-create --name external-subnet external 172.19.0.0/24 --dns-nameserver 8.8.8.8 --disable-dhcp
sudo ip addr add 172.19.0.1/24 dev br-ex
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
@yuuichi-fujioka
yuuichi-fujioka / create lib-project.sh
Last active February 4, 2016 11:17
Create Library Project with Gradle using android CLI available gradle tool versions are listed in http://mvnrepository.com/artifact/com.android.tools.build/gradle
android create lib-project -t 7 -g -v 1.5.0 -p testlib -k jp.test.lib -n testlib
@yuuichi-fujioka
yuuichi-fujioka / iptables-save.txt
Created January 29, 2016 00:12
allow incoming ssh only and outgoing http(s).
*nat
:PREROUTING ACCEPT [3468:453807]
:INPUT ACCEPT [7:412]
:OUTPUT ACCEPT [872:59514]
:POSTROUTING ACCEPT [872:59514]
:DOCKER - [0:0]
COMMIT
*filter
:INPUT DROP [30:5670]
:FORWARD DROP [0:0]
@yuuichi-fujioka
yuuichi-fujioka / mk_barb_cert_container.sh
Created January 19, 2016 00:33
barbican certificate container with passphrase
#!/bin/bash
barbican secret store --payload-content-type='text/plain' --name='test_cert' --payload="$(cat test_cert.pem)"
barbican secret store --payload-content-type='text/plain' --name='test_key' --payload="$(cat test_key.pem)"
barbican secret store --payload-content-type='text/plain' --name='test_passphrase' --payload="password"
barbican secret container create --name='tls_container' --type='certificate' --secret="certificate=$(barbican secret list | awk '/ test_cert / {print $2}')" --secret="private_key=$(barbican secret list | awk '/ test_key / {print $2}')" --secret="private_key_passphrase=$(barbican secret list | awk '/ test_passphrase / {print $2}')"