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
node -e '(e=require("express"))().use(e.static("htdocs")).listen(3000)' |
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
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 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 | |
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 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
{ | |
"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 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 | |
docker="$(egrep ':/docker/[0-9a-f]+$' /proc/self/cgroup | head -1)" | |
docker="${docker##*/}" | |
hostname "docker-${docker:0:8}" |
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/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 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/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 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/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 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
openssl aes-256-cbc -e -in /dev/null -pass pass: | base64 | cut -c 16-31 |
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
curl https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c | gcc -Wall -Werror -g -xc - -o su-exec |