Skip to content

Instantly share code, notes, and snippets.

View todiadiyatmo's full-sized avatar

Todi Adiyatmo Wijoyo todiadiyatmo

View GitHub Profile
@todiadiyatmo
todiadiyatmo / prototype-js-boilerplate
Last active August 29, 2015 14:15
Javascript OOP - Prototype Boilerplate
var vehicle = {};
vehicle.drive = function () {
console.log('vrooom...');
};
// Create -> Make car "inherit" vehicle
var car = Object.create(vehicle);
car.honk = function() {
*.log
*.zip
*.rar
robots.txt
.htaccess
sitemap.xml
sitemap.xml.gz
wp-config.php
wp-content/*
!wp-content/mu-plugins/

Nginx

user  nobody;
# no need for more workers in the proxy mode
worker_processes  4;
error_log  /var/log/nginx/error.log warn;
worker_rlimit_nofile 20480;
events {
	worker_connections 4048; # increase for busier servers
@todiadiyatmo
todiadiyatmo / log + config location.md
Last active February 24, 2016 04:44
Log Location config

journalctl

journalctl -u mysql.service

System

tail -f /var/log/messages -n 1000 | grep --line-buffered "timeout"
@todiadiyatmo
todiadiyatmo / php.ini
Last active November 17, 2015 03:44
php.ini
#/usr/lib/php.ini -> on the bottom
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so
opcache.memory_consumption=64
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=7963
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
# Database
- Pastikan InnoDB
- Maria DB Engine
- https://wordpress.org/plugins/wp-optimize/ (per client approval)
# Plugin
- https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/
- Wang guard
# Backup

Speedtest

wget http://todiadiyatmo.com/speedbench.sh 2>/dev/null -O- | bash

www-data

adduser xxxx
ssh-keygen -t rsa -b 4096 -C "[email protected]"
## Track checkout remote branch
```
git checkout --track origin/serverfix
```
## Git track remote from current branch
```
git branch -u origin/serverfix
```
@todiadiyatmo
todiadiyatmo / post-receive
Last active August 29, 2015 14:24
Post Receive
#!/bin/sh
git --work-tree=/home/tiga/tiga-make --git-dir=/home/tiga/repo/site.git checkout -f
cd /home/tiga/tiga-make
chmod 755 . -R
/usr/local/bin/php /usr/local/bin/composer install
/usr/local/bin/php artisan tiga-make:clean
/usr/local/bin/php artisan asset:dist
/usr/local/bin/php artisan optimize
@todiadiyatmo
todiadiyatmo / nginx cloudflare
Last active February 4, 2025 13:53
nginx cloudflare
#CloudFlare
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;