Skip to content

Instantly share code, notes, and snippets.

View takenoko-str's full-sized avatar
🎯
Focusing

takenoko-str takenoko-str

🎯
Focusing
  • 35.07103745548258, 135.29974566562086
View GitHub Profile
@takenoko-str
takenoko-str / escape.sh
Last active January 22, 2018 11:58
know_hosts on development environment
#!/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
#!/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,
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")
#!/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)
@takenoko-str
takenoko-str / README.md
Last active October 18, 2021 21:47
memory checker script

Usage example

# python mem.py `pgrep docker`

@takenoko-str
takenoko-str / named_ebs_volume.py
Last active March 5, 2017 02:20
AWS Lambda function to sync tag name between ebs volumes and the attached instance.
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)
@takenoko-str
takenoko-str / .profile
Last active January 24, 2017 04:39
this is a part of useful operation grep.
# 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
@takenoko-str
takenoko-str / README.md
Last active August 9, 2019 01:34
My Ansible inventroy file for ec2.py

Mac OSX

  • 配置
# default hosts
/Users/takuya/hosts
# dot dir
/Users/takuya/.ansible

@takenoko-str
takenoko-str / ansible.cfg
Last active September 29, 2019 08:43
My Ansible config file for ec2.py
# 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]
@takenoko-str
takenoko-str / proftpd_policyadd.sh
Last active February 24, 2017 04:41
A primitive script that delete ip addr on iptables.
#!/bin/sh
IPTABLES_POLICY=/etc/sysconfig/iptables
function usage {
cat <<EOF
$(basename ${0}) is a tool for ...
Usage:
$(basename ${0}) [command] [<options>]