Skip to content

Instantly share code, notes, and snippets.

View yyoshiki41's full-sized avatar
๐Ÿ“ป

Yoshiki Nakagawa yyoshiki41

๐Ÿ“ป
View GitHub Profile

1. Create AMI

โ€ป ็พๅœจ็จผๅƒไธญใฎใ‚ตใƒผใƒใƒผใ‹ใ‚‰Imageใ‚’ไฝœใ‚‹ๅ ดๅˆใฏใ€No Reboot ใซใƒใ‚งใƒƒใ‚ฏ๏ผŽ

2. Create Launch Configurations

โ‘  Choose AMI

โ‘ก Configure details

  • Cloud Watch ใฏไปปๆ„(่ฟฝๅŠ ๆ–™้‡‘ใŒ็™บ็”Ÿใ™ใ‚‹)
@yyoshiki41
yyoshiki41 / stress_test.md
Last active December 31, 2015 11:57
Stress Test for Linux

A. stress

Install

sudo yum install stress

ex.1) CPUใซ่ฒ ่ทใ‚’ใ‹ใ‘ใ‚‹ไพ‹(2ใคใฎstressใƒ—ใƒญใ‚ปใ‚นใŒ่ตทๅ‹•ใ—ใ€2ๅˆ†้–“sqrt()ใ‚’ๅฎŸ่กŒใ™ใ‚‹๏ผŽ)

@yyoshiki41
yyoshiki41 / fmt_nginx-V.sh
Last active December 19, 2015 13:44
Format "$ nginx -V"
# format all
$ nginx -V 2>&1 | sed 's/--/\n--/g'
# format module only
$ nginx -V 2>&1 | sed 's/--with/\n--with/g'
@yyoshiki41
yyoshiki41 / slack.rb
Last active December 19, 2015 12:23
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://hooks.slack.com/services/****")
payload = {
text: "ใ“ใ‚“ใชใ‹ใ‚“ใ˜ใงใ„ใ‘ใ‚‹",
channel: "@dareka",
username: "oreore",
icon_emoji: ":ghost:"
@yyoshiki41
yyoshiki41 / num.txt
Last active December 19, 2015 12:17
โ”โ”โ”โ”“
โ”—โ”“ โ”ƒ
โ”ƒ โ”ƒ
โ”ƒ โ”ƒ
โ”ƒ โ”ƒ
โ”ƒ โ”ƒ
โ”โ”› โ”—โ”“
โ”—โ”โ”โ”โ”›
โ”โ”โ”โ”โ”“
โ”ƒโ”โ”โ”“โ”ƒ
<?php
// Create connection
$mysqli = new mysqli('HOST', 'USER', 'PW');
// Check connection
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
// Check DB server
if ($mysqli->ping()) {
@yyoshiki41
yyoshiki41 / var_display_max.php
Created August 29, 2014 02:00
xdebug ใง var_dump ็œ็•ฅใ•ใ‚Œใ‚‹ใฎใ‚’้˜ฒใ
ini_set('xdebug.var_display_max_data', 4096);
ini_set('xdebug.var_display_max_depth', 20);
var_dump();
@yyoshiki41
yyoshiki41 / cal_age.sql
Last active December 19, 2015 12:21
Calculate age from date (1900-01-01)
SELECT (YEAR(current_date())-YEAR(`dob`)) - (RIGHT(current_date(),5) < RIGHT(`dob`,5)) AS age
FROM `table_name`
@yyoshiki41
yyoshiki41 / min_contents.js
Created March 14, 2014 15:17
Set min_height
// #contents { min-height: }
function getBrowserHeight() {
if ( window.innerHeight ) {
return window.innerHeight;
}
else if ( document.documentElement && document.documentElement.clientHeight != 0 ) {
return document.documentElement.clientHeight;
}
else if ( document.body ) {
return document.body.clientHeight;
@yyoshiki41
yyoshiki41 / reset.css
Created March 9, 2014 04:31
Remove tap_shadow
a {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-moz-tap-highlight-color: rgba(0, 0, 0, 0);
tap-highlight-color: rgba(0, 0, 0, 0);
}