# python mem.py `pgrep docker`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# escape know_hosts problem | |
# if you can not connect remote-server with ssh because of changing dns record frequestly, | |
# you can use this script. set error message "Offending key for IP in /home/takenoko/.ssh/known_hosts:688" | |
argv=$1 | |
known_hosts=$(echo $argv | awk -F':' '{print $1}') | |
if [ -z $konw_hosts ]; then | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, time | |
def one_satisfied_bar(char='#',length=100): | |
for i in range(length): | |
sharp = -abs(i-length//2) + length//2 | |
space = abs(i-length//2) | |
txt = '|' + char*sharp + '>' + ' '*space + '|' + '\r' | |
#sys.stdout.write(txt) | |
print txt, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
target_host = "www.google.com" | |
target_port = 80 | |
client = socket(socket.AF_INET, socket.SOCK_STREAM) | |
client_connect((target_host, target_port)) | |
client.send("GET / HTTP/1.1\r\nHost: google.com\r\n\r\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from random import choice | |
import string | |
def gen_passwd(length=8, chars=string.letters+string.digits+string.punctuation): | |
return ''.join([ choice(chars) for i in range(length) ]) | |
for i in range(6): | |
print gen_passwd(12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
import sys | |
import botocore.exceptions | |
client = boto3.client('ec2') | |
ec2 = boto3.resource('ec2') | |
def get_instance_volume_list(client, data={}, filters=[]): | |
response = client.describe_volumes(Filters=filters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Case 1. | |
# You can use sgrep to escape # comment out or blank lines | |
alias sgrep='egrep -v "^\s*(#|$)" --color=auto' | |
# Case 2. | |
# You can use cgrep to separate from pure comment and default option. | |
# For basically default options, there is no white spaces between # and the sentence. | |
# ex) in my opinion | |
# This is a pure comment blablabla | |
#this_is=default_option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config file for ansible -- http://ansible.com/ | |
# ============================================== | |
# nearly all parameters can be overridden in ansible-playbook | |
# or with command line flags. ansible will read ANSIBLE_CONFIG, | |
# ansible.cfg in the current working directory, .ansible.cfg in | |
# the home directory or /etc/ansible/ansible.cfg, whichever it | |
# finds first | |
[defaults] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IPTABLES_POLICY=/etc/sysconfig/iptables | |
function usage { | |
cat <<EOF | |
$(basename ${0}) is a tool for ... | |
Usage: | |
$(basename ${0}) [command] [<options>] |
OlderNewer