Skip to content

Instantly share code, notes, and snippets.

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

Tai Ha hataiit9x

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am hataiit9x on github.
* I am thinkvn9x (https://keybase.io/thinkvn9x) on keybase.
* I have a public key ASDyTkwB3YdMohgegVKc2KKHzz5h0rNzXhBphThTf0sFaAo
To claim this, I am signing this object:
@hataiit9x
hataiit9x / swap.sh
Created October 8, 2019 15:08 — forked from Repox/swap.sh
Shell script for adding swap to Linux
#!/bin/sh
# size of swapfile in megabytes
swapsize=1024
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@hataiit9x
hataiit9x / swap.sh
Created October 8, 2019 15:08 — forked from Repox/swap.sh
Shell script for adding swap to Linux
#!/bin/sh
# size of swapfile in megabytes
swapsize=1024
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@hataiit9x
hataiit9x / nginx.conf
Created July 9, 2020 02:56 — forked from 6aditya8/nginx.conf
Nginx SSL/TLS configuration for getting "A+" in Qualys SSL Labs test
# Configuration options are limited to SSL/TLS
# Enable SSL session caching for improving performance by avoiding the costly session negotiation process where possible
# SSL Labs doesn't assume that SNI is available to the client, so it only tests the default virtual server
# setting this globally to make it work across all the nginx virtual servers (including the default virtual server)
ssl_session_cache shared:ssl_session_cache:10m;
ssl_session_timeout 10m;
server {
listen 443 ssl;
@hataiit9x
hataiit9x / pushlog.php
Last active November 3, 2021 01:54
pushLogs
<?php
public function pushLogs($msg, $post_data)
{
//curl実行
$data = [
"message" => $msg,
"data" => $post_data
];
$ch_exec = curl_init("https://{domain}/api/debug-logs");
@hataiit9x
hataiit9x / .htaccess
Created January 20, 2022 11:00 — forked from indysigner/.htaccess
Die optimale .htaccess-Datei für mehr Speed und Sicherheit
# ----------------------------------------------------------------------
# | Komprimierung und Caching |
# ----------------------------------------------------------------------
# Serve resources with far-future expires headers.
#
# (!) If you don't control versioning with filename-based
# cache busting, you should consider lowering the cache times
# to something like one week.
#
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@hataiit9x
hataiit9x / test-memcached.php
Created March 14, 2022 08:01 — forked from maartendekeizer/test-memcached.php
Memcached test script
<?php
/**
* @license MIT License
* @copyright maartendekeizer
*/
$memcached = new Memcached();
$memcached->addServer('127.0.0.1', 11211);
@hataiit9x
hataiit9x / aws_ec2_start_stop.json
Created September 13, 2022 09:03 — forked from amitavroy/aws_ec2_start_stop.json
AWS EC2 Start Stop Lambda
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:Start*",
"ec2:Stop*",
"ec2:DescribeInstanceStatus"
@hataiit9x
hataiit9x / README.md
Created September 28, 2022 04:29 — forked from TheBinitGhimire/README.md
Getting an AWS Educate account with $100 worth of cloud credits!