Skip to content

Instantly share code, notes, and snippets.

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

amekusa amekusa

🏠
Working from home
View GitHub Profile
@amekusa
amekusa / rkhunter-propupd.hook
Last active October 21, 2022 03:10
Rkhunter Setup
# dir: /etc/pacman.d/hooks/
[Trigger]
Operation = Upgrade
Type = Package
Target = *
[Action]
Description = rkhunter --propupd
When = PostTransaction
@amekusa
amekusa / my-php.ini
Last active February 12, 2022 07:47
PHP Good Practice
; Custom PHP Settings
; --------------------- ---- -- -
; Place this file in: /etc/php/conf.d
;memory_limit = 128M
memory_limit = 512M
; Fix "JIT compilation failed" in PHP 7.3
pcre.jit=0
@amekusa
amekusa / dynamic-getter-setter.php
Last active November 23, 2018 05:31
Dynamic getter/setter implementation for PHP
<?php
/**
* Example class
*/
class Dog {
private $name, $breed, $age;
public function __call($Fn, $Args) {
$act = substr($Fn, 0, 3);
@amekusa
amekusa / .gitignore_global
Last active April 19, 2020 05:40
Global .gitignore
# Global .gitignore
#
# To take effect, place this file on your home dir and run this command:
# $ git config --global core.excludesfile ~/.gitignore_global
#
# Created by https://www.gitignore.io/api/node,linux,macos,windows,eclipse
# Edit at https://www.gitignore.io/?templates=node,linux,macos,windows,eclipse
### Eclipse ###
# ----------------- ---- -- -
# Custom Settings
# From 2020.04.23
# Anonymize
visible_hostname none
forwarded_for off
via off
# Remove some HTTP headers
// SomeClass.js
class SomeClass {
constructor() {
}
}
export default SomeClass
// index.js
import SomeClass from './SomeClass.js'
let x = new SomeClass()
/**
* Extensible Function
* @update 2021-07-26
*/
class Callable extends Function {
constructor() {
super('...args', 'return this.__self.__call(...args)');
this.__self = this.bind(this);
return this.__self;
}
@amekusa
amekusa / mac-wifi-monitor.sh
Last active September 26, 2021 21:16
Mac WiFI Monitor; A bash script that keeps checking if the WiFi connection alive on your Mac by continuously sending pings to the router and public DNSes. If the connection seemed lost nonetheless, the script automatically restarts the WiFi adapter.
#!/bin/bash
# Mac WiFi Monitor
# ------------------ ---- -- -
# Keeps checking if the WiFi connection alive
# by continuously sending pings to the router and public DNSes.
# If the connection seemed lost nonetheless,
# automatically restarts the WiFi device on your Mac
# ====================================================
# Author: amekusa.com
cd /srv/http

# set owner to you
sudo chown -R you example1.com example2.com

# set group to http
sudo chgrp -R http example1.com example2.com
sudo chmod g+s example1.com example2.com
@amekusa
amekusa / iptables-test.sh
Last active June 29, 2022 03:51
Learn how iptables actually works by testing by yourself
#!/bin/bash
# NOTE:
#
# To run (DO NOT RUN on your production server):
# sudo ./iptables-test.sh
#
# To test:
# ping -c 1 <ip address>
#