Skip to content

Instantly share code, notes, and snippets.

@aminamid
aminamid / del_all.sh
Last active August 29, 2015 14:18
gitbucketのrepositoryをbitbucketでバックアップする ref: http://qiita.com/aminamid/items/1a6d685715af23e74ab4
#!/bin/bash
GB_LOCAL_REPO=/var/gitbucket/data/repositories
MIRROR_BASE=/var/gitbucket/mirrors
SRC_BASE=${GB_LOCAL_REPO}/
[email protected]:
DST_USER=bitbucketuser
function repo_put() {
curl -X POST \
@aminamid
aminamid / gist:a30da7887771dc2671c9
Created April 7, 2015 07:58
pac system-statistics
## System configurations
get following informations by root
### files:
/etc/security/limits.conf
/proc/cpuinfo
### commands:
@aminamid
aminamid / gist:fd0ada8761ca92851b3f
Last active August 29, 2015 14:18
bash get abs dirname of the script
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(readlink "$name" || true)"
done
@aminamid
aminamid / gist:f753facc9ada2a7e62ec
Last active August 29, 2015 14:18
bash avoid duplicate pathes in PATH or LD_LIBRARY_PATH
LD_LIBRARY_PATH=${HOME}/lib:$LD_LIBRARY_PATH
INCLUDE=${HOME}/include:$INCLUDE
[ -z "$ld_library_path" ] && typeset -T LD_LIBRARY_PATH ld_library_path
[ -z "$include" ] && typeset -T INCLUDE include
typeset -U path cdpath fpath manpath ld_library_path include
@aminamid
aminamid / convert statsf files
Last active August 29, 2015 14:17
convert statsf files
zcat 20150325*_log/elmsto20*/mss.elmsto*stat.gz | grep StatMssCassandraGetSliceWithSliceRange | sed -e 's#[/]# #g' | awk '{print $2,$3,$7,$9,$16,$17}' | sed -e 's/\(..\)\(..\)\(..\)\(...\)+\(....\) /\1:\2:\3.\4 /' | sed 's/\(..:..:\)\([012].....\) /\100 /' | sed 's/\(..:..:\)\([345].....\) /\130 /' > ~/work/aminamid/cmpare/slicerange.txt
for s in 1 2 3 4 5 6 7 8 9 ; do sar -f ../elcdto20${s}_sar.201503250500 -n ETCP -s 12:30:00 -e 14:10:00 | awk "{print \""'elcdto20'${s}"\",\$0; fflush() }"; done
zcat elms*/mss*stat.gz | grep -e StatMssCassandraGetSliceWithSliceRange -e StatMssRmeImapSelectTime -e StatMssSLRmeCreateMessageTime | sed 's# [^ ;]*;\(.*\)(.*\/[^)]*) # \1 #' | sed -e 's#[/]# #g' | awk '{print $2,$3,$5,$6,$8,$15,$16}' | sed -e 's/\(..\)\(..\)\(..\)\(...\)+\(....\) /\1:\2:\3.\4 /' | sed 's/\(..:..:\)\([012].....\) /\100 /' | sed 's/\(..:..:\)\([345].....\) /\130 /'
cat xxx | while read line ; do echo ${line} | sed -e "s/.*\(172.25.105.9.\).\(....\) \(172.25.105.9.\).\(.....\): .*$/tcpdump -nn -r e
@aminamid
aminamid / gist:68d0fe65ffd5bcac1687
Last active October 4, 2017 20:35
decode fftp pw
#!/usr/bin/perl
use strict;
use warnings;
use Crypt::CBC;
use Crypt::Rijndael;
use Digest::SHA1 qw(sha1);
sub main() {
@aminamid
aminamid / gist-file0.txt
Last active August 29, 2015 14:17
tmux_tips
## multisessions
http://tech.naviplus.co.jp/2014/01/09/tmux%E3%81%A7%E8%A4%87%E6%95%B0%E3%82%B5%E3%83%BC%E3%83%90%E3%81%AE%E5%90%8C%E6%99%82%E3%82%AA%E3%83%9A%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3/
switch sync/async
```
set-window-option synchronize-panes on
set-window-option synchronize-panes off
```
@aminamid
aminamid / gist-file0.txt
Created March 24, 2015 04:17
bash_stdout_stderr
echo 'stout to stderr' 1>&2
@aminamid
aminamid / gist-file0.txt
Last active August 29, 2015 14:17
linux_sshkey
cd ~/ssh
ssh-keygen -t rsa -C [email protected] -f id_peko
~/.ssh/config
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa
User git
@aminamid
aminamid / common.py
Last active October 22, 2018 08:23
ぼくのかんがえたpython2.6こまんどらいんあぷりひながた ref: https://qiita.com/aminamid/items/99eb7ec1c71809ebee92
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import datetime
import itertools
def concat( ll ):
return list(itertools.chain(*ll))