This file contains hidden or 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
<?php | |
echo "Hello"; |
This file contains hidden or 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
#テーブルの初期化 | |
TRUNCATE TABLE tablename; | |
#複数のカラムでユニークキーを張る | |
ALTER TABLE tablename ADD CONSTRAINT UNIQUE (column1, column2); | |
#テーブルにカラムを追加する | |
ALTER TABLE tablename ADD COLUMN columnname rule AFTER columnname; | |
ex.)ALTER TABLE users ADD COLUMN rest_partner_num int NOT NULL DEFAULT 20 AFTER tutorial; |
This file contains hidden or 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
<?php | |
//ユーザ情報配列からidだけ抜き出す | |
$users = array( | |
array('id' => 1, 'name' => 'name1'), | |
array('id' => 2, 'name' => 'name2'), | |
array('id' => 3, 'name' => 'name3'), | |
array('id' => 4, 'name' => 'name4') | |
); |
This file contains hidden or 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
# 連番でディレクトリを作成 | |
seq 1 10 | xargs -t -i mkdir test_{} | |
mkdir test_{1..10} |
This file contains hidden or 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/bash | |
TMP_SAVE_DIR="/home/ --" | |
TARGET_URL="http://" | |
TARGET_FILE="target" | |
TARGET_FILE_TMP="target.tmp" | |
if [ ! -d ${TMP_SAVE_DIR} ]; then | |
mkdir -p ${TMP_SAVE_DIR} | |
if [ $? != 0 ]; then |
This file contains hidden or 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
require 'rubygems' | |
require 'right_aws' | |
access_key_id = "your-access-key-id" | |
secret_access_key = "your-secret-access-key" | |
ENV["ACW_URL"] = "https://monitoring.ap-northeast-1.amazonaws.com:443/" | |
ENV["RDS_URL"] = "https://rds.ap-northeast-1.amazonaws.com:443/" | |
This file contains hidden or 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
target_dir = "PATH/TO/TARGETDIR" | |
output_dir = "PATH/TO/OUTPUTDIR" | |
Dir.chdir(target_dir) | |
for i in Dir.glob("*").sort.each | |
f = open(output_dir + i + ".txt", "w") | |
Dir.chdir(i) | |
for rpm in Dir.glob("*").sort.each | |
f.write(rpm + "\n") |
This file contains hidden or 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
require "pp" | |
require 'base64' | |
f = open("list") | |
while name = f.gets | |
name = name.chomp | |
result = `ldapsearch -x -LLL -t "(uid=#{name})"` | |
uid_number = result.scan(/uidNumber: (\d*)/).flatten[0] | |
user_password = result.scan(/userPassword:: (.*)\s/).flatten[0] |
This file contains hidden or 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
# Target Region | |
:region: ap-northeast-1 | |
# Target Accounts | |
:accounts: | |
test_account: | |
:access_key_id: ACCESS_KEY_ID | |
:secret_access_key: SECRET_ACCESS_KEY |
This file contains hidden or 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
def exec_command(command, dry_run = false) | |
if dry_run | |
puts command | |
return | |
end | |
begin | |
PTY.spawn(command) do |stdin, stdout, pid| | |
begin | |
line = '' |
OlderNewer