Skip to content

Instantly share code, notes, and snippets.

@binhp
binhp / 0-aws-lamda-start-stop-instances.md
Last active February 11, 2024 01:50
AWS EC2 Schedule to Start/Stop

AWS Schedule to Start/Stop EC2

by Cloud Watch and Lamda Function

@binhp
binhp / 0-self-signed-ssl.md
Last active October 23, 2018 04:32
Development Self-signed SSL with local trust

Create self-signed certificate for nginx/apache


chmod +x ./*.sh
./1-create-cert.sh
## add to trusted certs for macOS
./2-osx-trust-cert.sh
echo "See sample nginx config"
cat 3-sample-nginx.conf
@binhp
binhp / 0-daily-backup.md
Created April 4, 2018 04:32
Backup Daily with logrotate

Daily backup with logrotate

@binhp
binhp / mood.md
Last active May 21, 2019 03:25
Mood

< mood | note | temp | trash >

@binhp
binhp / .bashrc
Last active October 23, 2018 04:39
Common Bash Commands as Util Functions
## wget *.tar.gz to stdout and g-unzip
function wgetgz(){
wget -q -O - $1 | tar -zxv --directory "${2:.}"
}
@binhp
binhp / ip-filter.sh
Last active April 3, 2022 09:39
Secure SSH Server with IP Country Restriction
#!/bin/bash
# License: WTFPL
## install geoip first
# apt-get install geoip-bin geoip-database
## /etc/hosts.allow
# sshd: ALL: aclexec /opt/scripts/ip-filter.sh %a
## /etc/hosts.deny
## sshd: ALL
@binhp
binhp / setup_debian_nginx_full.md
Last active October 23, 2018 04:36
Debian 9 + Nginx Completed New Setup Guide with Scripts
########################################
## BEGIN NGINX SETUP from scratch
########################################

DEBIAN_CODE=$(dpkg --status tzdata|grep Provides|cut -f2 -d'-')

NGINX_DEB_MAINLINE="http://nginx.org/packages/mainline/debian/"
NGINX_DEB_STABLE="http://nginx.org/packages/debian/"
# change distribution you want here
@binhp
binhp / __etc__sysctl.conf
Last active November 24, 2019 05:47
debian rootfs security best practices
# after update run `sudo sysctl -p`
# Avoid a smurf attack
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Turn on protection for bad icmp error messages
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Turn on syncookies for SYN flood attack protection
net.ipv4.tcp_syncookies = 1
@binhp
binhp / Dockerfile-java8
Last active October 23, 2018 04:41
Docker debian 8 + java 8
# Pull base image.
FROM launcher.gcr.io/google/debian8:latest
# Install Java.
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
@binhp
binhp / Netsuite-AWS-Module-Guide.md
Last active June 3, 2024 03:40
Netsuite AWS Module

AWS Module for Netsuite

AWS.S3

1. Add S3 lib

Upload ns-aws-s3.js to Netsuite Files at /SuiteScripts/lib/ns-aws-s3

File /SuiteScripts/lib/ns-aws-s3