Skip to content

Instantly share code, notes, and snippets.

Avatar

Akihiro Motoki amotoki

View GitHub Profile
@amotoki
amotoki / ssh-agent-check.sh
Created Dec 27, 2013
Reuse an existing ssh-agent process
View ssh-agent-check.sh
#!/bin/sh
USERNAME=`whoami`
NUM=`ps -ef | grep ssh-agent | grep -v grep | grep $USERNAME | wc -l`
if [ $NUM -eq 1 ]; then
ST=`ps -ef | grep ssh-agent | grep -v grep | grep $USERNAME`
AGENT_PID=$(echo $ST | awk '{print $2;}')
SOCKFILE=$(ls -l /tmp/ssh-*/agent.[0-9]* | grep $USERNAME | sed -e 's/^.*\(\/tmp\/ssh-.*\)/\1/')
echo "echo SOCKFILE=$SOCKFILE;"
View gist:7941041
ESC は ESC コードをいれる
Emacs だと C-q ESC, vi だと C-v ESC
/etc/nova/nova.conf
logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s ESC[01;35m%(instance)sESC[00m
logging_debug_format_suffix = ESC[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)dESC[00m
logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [ESC[00;36m-%(color)s] ESC[01;35m%(instance)s%(color)s%(message)sESC[00m
logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [ESC[01;36m%(request_id)s ESC[00;36m%(user_name)s %(project_name)s%(color)s] ESC[01;35m%(instance)s%(color)s%(message)sESC[00m
@amotoki
amotoki / rectangle.el
Created Sep 29, 2013
Insert a decimal or hex incremental/decremental number into a region
View rectangle.el
;; Copyright (C) 2013 Akihiro Motoki <amotoki@gmail.com>
;; Author: Akihiro Motoki <amotoki@gmail.com>
;; Keywords: convenience rectangle
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
View udev-update.py
#!/usr/bin/env python
import argparse
import logging
import re
import sys
import pprint
#-------------------------------------------------
@amotoki
amotoki / po-file-update.sh
Last active Dec 22, 2015
Check the I18N strings in Horizon repository are updated and create a new commit if any
View po-file-update.sh
#!/bin/bash -e
# Latest version is available at
# https://github.com/amotoki/horizon-i18n-tools/blob/master/po-file-update.sh
function is_updated() {
local file=$1
git diff $file | \
grep -E '^[-+]' | \
grep -v -E '^[-+]#:' | \
@amotoki
amotoki / localrc-havana-allinone
Last active Dec 22, 2015
devstack all-in-one localrc for Havana
View localrc-havana-allinone
# Neutron
# To use nova-network, comment out the following
PRIVATE_NETWORK_NAME=net1
PUBLIC_NETWORK_NAME=ext_net
Q_PLUGIN=ml2
disable_service n-net
enable_service neutron q-svc q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
@amotoki
amotoki / po-fuzzy-diff.el
Created Aug 20, 2013
Compare the difference in PO fuzzy string
View po-fuzzy-diff.el
;;; po-fuzzy-diff.el --- Compare the difference in PO fuzzy string
;; Copyright (C) 2013 Akihiro Motoki <amotoki@gmail.com>
;; Author: Akihiro Motoki <amotoki@gmail.com>
;; Keywords: convenience po-mode
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
@amotoki
amotoki / localrc
Last active Dec 21, 2015
devstack stable/grizzly localrc with Neutron OVS plugin as compute node
View localrc
# -*- mode: bash -*-
#-----------------------------
# Common congigurations
#-----------------------------
CFGDIR=$HOME/tool/config
source $CFGDIR/01-proxy
source $CFGDIR/02-repos
source $CFGDIR/10-local
@amotoki
amotoki / localrc-hv
Last active Dec 21, 2015
devstack stable/grizzly localrc with Neutron OVS plugin as controller node
View localrc-hv
# -*- mode: bash -*-
#-----------------------------
# Common congigurations
#-----------------------------
CFGDIR=$HOME/tool/config
source $CFGDIR/01-proxy
source $CFGDIR/02-repos
source $CFGDIR/10-local