Skip to content

Instantly share code, notes, and snippets.

View kevingo's full-sized avatar
🏠
Working from home

kevingo kevingo

🏠
Working from home
View GitHub Profile
@kevingo
kevingo / shell.sh
Last active July 3, 2017 11:44
CloudWatch for Memory usage
$ sudo apt-get update
$ sudo apt-get install unzip
$ sudo apt-get install libwww-perl libdatetime-perl
curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O
unzip CloudWatchMonitoringScripts-1.2.1.zip
rm CloudWatchMonitoringScripts-1.2.1.zip
cd aws-scripts-mon
*/5 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --from-cron
@kevingo
kevingo / shell.sh
Created May 30, 2016 02:16
List directories and sort by size
#!/bin/bash
du -h --max-depth=1 | sort -hr
@kevingo
kevingo / README.md
Last active July 20, 2023 17:00
Install Redis with Docker in Ubuntu 14.04

1. Create Docekrfile

mkdir redis && touch Dockerfile

2. Create Redis Dockerfile

FROM ubuntu:14.04
@kevingo
kevingo / shell.sh
Created May 18, 2016 09:44
Install Nginx with newest version
sudo -s
add-apt-repository ppa:nginx/stable
apt-get update
apt-get dist-upgrade
@kevingo
kevingo / shell.sh
Created May 17, 2016 09:38
Install Composer on Mac OS X
#!/bin/bash
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'a52be7b8724e47499b039d53415953cc3d5b459b9d9c0308301f867921c19efc623b81dfef8fc2be194a5cf56945d223') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
# Make executable everywhere
mv composer.phar /usr/local/bin/composer
@kevingo
kevingo / aws-certification.md
Last active May 17, 2016 15:49 — forked from miglen/aws-certification.md
AWS Certification notes

AWS Certification notes

Those are my personal notes on AWS Solution Architect certification preparation. Hope you find them usefull.

To pass AWS certification, you should have:

  • Sound knowledge about most of the AWS services ( EC2, VPC, RDS, Cloudfront, S3, Route53 etc,)
  • Hands on experience with AWS services.
  • Good knowledge of disaster recovery, security and High availability architectures.

If you do not have prior hands-on experience and knowledge or you have little knowledge about AWS services, it is better to take an online course. If you already have experience in architecting solutions on AWS it is not necessary to take an online course.

@kevingo
kevingo / letencrypt.md
Last active January 17, 2017 09:36
Using Let's Encrypt in Ubuntu 14.04 with Nginx

相信大家都知道 Let's Encrypt 是一個免費提供SSL 憑證的 CA (certificate authority) ,過去要申請 SSL 的憑證,往往需要每年花一筆錢向其他的認證公司來申請,而且光是填寫申請表,到憑證核發下來,可能都過了好幾天了,現在有 Let's Encrypt 這樣透過 Shell 就可以直接核發憑證的機構出現,大家還有什麼理由不將自己管理的網站加上 SSL 呢?

這裏記錄一下透過 Let's Encrypt 官方的工具來申請憑證的過程給大家參考。這裏我是用 Nginx 當成掛載 SSL 憑證的 web server。

1. 首先要下載官方的工具

$ git clone https://github.com/letsencrypt/letsencrypt
$ cd letsencrypt
$ ./letsencrypt-auto --help
@kevingo
kevingo / shell.sh
Last active May 6, 2016 03:38
Find number of files
for i in /*; do echo $i; find $i |wc -l; done
[http://www.ivankuznetsov.com/2010/02/no-space-left-on-device-running-out-of-inodes.html](http://www.ivankuznetsov.com/2010/02/no-space-left-on-device-running-out-of-inodes.html)
(http://www.ivankuznetsov.com/2010/02/no-space-left-on-device-running-out-of-inodes.html)[http://www.ivankuznetsov.com/2010/02/no-space-left-on-device-running-out-of-inodes.html]
@kevingo
kevingo / shell.sh
Created May 1, 2016 02:23
Port forwarding from 80 to 3000
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
@kevingo
kevingo / shell.sh
Last active May 1, 2016 01:56
Self-Signed SSL Certificate and Key
#!/bin/bash
# Generate Private Key
openssl genrsa -out privatekey.pem 1024
# Generate CSR certificate with private key
openssl req -new -key privatekey.pem -out certrequest.csr
# Generate certificate with CSR certificate and private key
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem