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
function readFile(path: string): Promise<Buffer> { | |
return new Promise((resolve, reject) => { | |
const readble = (path === "-") ? process.stdin : fs.createReadStream(path); | |
readble.on("error", reject).pipe(concatStream(resolve)); | |
}); | |
} |
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/bash | |
aws ec2 describe-tags --region ap-northeast-1 --output text \ | |
--query 'Tags[?Key==`Name`].Value|[0]' \ | |
--filter "Name=resource-id,Values=$(curl -s http://169.254.169.254/latest/meta-data/instance-id/)" | \ | |
xargs sudo hostnamectl set-hostname | |
sudo sh -lc "echo 'preserve_hostname: true' > /etc/cloud/cloud.cfg.d/50_preserve_hostname.cfg" |
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
{ | |
"agent": { | |
"metrics_collection_interval": 60, | |
"logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log", | |
"region": "ap-northeast-1" | |
}, | |
"metrics": { | |
"metrics_collected": { | |
"cpu": { | |
"measurement": [ |
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/bash | |
docker="$(egrep ':/docker/[0-9a-f]+$' /proc/self/cgroup | head -1)" | |
docker="${docker##*/}" | |
hostname "docker-${docker:0:8}" |
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 | |
node --max-old-space-size=1000 -e 'console.log(Math.floor(v8.getHeapStatistics().heap_size_limit/1024/1024))' | |
# 1049 | |
node -e 'console.log(Math.floor(v8.getHeapStatistics().heap_size_limit/1024/1024))' | |
# 1456 | |
node --max-old-space-size=2000 -e 'console.log(Math.floor(v8.getHeapStatistics().heap_size_limit/1024/1024))' | |
# 2066 |
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 | |
# @see https://github.com/docker/for-mac/issues/770 | |
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 1234:1234 alpine/socat TCP-LISTEN:1234,fork UNIX-CONNECT:/var/run/docker.sock |
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 | |
# Name: aws-describe-to-md.sh | |
# Gist: https://gist.github.com/kawanet/5c135535d9bf49722b96cab29fa94708 | |
# Author: 2019 Yusuke Kawasaki | |
# License: MIT | |
# | |
# Download: | |
# curl -o aws-describe-to-md.sh https://gist.githubusercontent.com/kawanet/5c135535d9bf49722b96cab29fa94708/raw/aws-describe-to-md.sh | |
# |
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
openssl aes-256-cbc -e -in /dev/null -pass pass: | base64 | cut -c 16-31 |
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
curl https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c | gcc -Wall -Werror -g -xc - -o su-exec |
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
package net.kawa.whitespacetests; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
/** | |
* @see https://developer.android.com/guide/topics/resources/string-resource | |
*/ |