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
@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 / .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!
@hataiit9x
hataiit9x / mastodon-installer-for-CentOS7x-with-KUSANAGI-at-SakuraVPS.sh
Created March 6, 2023 05:27 — forked from KEINOS/mastodon-installer-for-CentOS7x-with-KUSANAGI-at-SakuraVPS.sh
さくらのVPS+KUSANAGI+CentOS7でMastodonをインストールするシェルスクリプト。One-liner Mastodon Instance installer for CentOS7.2 with KUSANAGI on SakuraVPS.
#!/bin/bash
echo
echo "-----------------------------"
echo " ╔╦╗╔═╗╔═╗╔╦╗╔═╗╔╦╗╔═╗╔╗╔"
echo " ║║║╠═╣╚═╗ ║ ║ ║ ║║║ ║║║║"
echo " ╩ ╩╩ ╩╚═╝ ╩ ╚═╝═╩╝╚═╝╝╚╝"
echo " Installer for Sakura VPS"
echo " (CentOS7x with KUSANAGI)"
echo "-----------------------------"
echo
@hataiit9x
hataiit9x / Dockerfile
Created May 9, 2023 03:36 — forked from rajeshisnepali/Dockerfile
php7.3-alpine-composer (Dockerfile)
# Set master image
FROM php:7.3-fpm-alpine
MAINTAINER Rajesh Chaudhary <rajeshisnepali@gmail.com>
# Copy composer.lock and composer.json
#COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www