Skip to content

Instantly share code, notes, and snippets.

View eru123's full-sized avatar

Jericho Aquino eru123

View GitHub Profile
@eru123
eru123 / debug.php
Created June 8, 2023 09:32
This will print the message to the output stream of your php server (php-cli or Apache2 access logs) by default
<?php
function debug($msg) {
$stdout = fopen('php://stdout', 'w');
$bt = debug_backtrace();
$caller = array_shift($bt);
$file = realpath($caller['file']);
$line = $caller['line'];
$debug = "[".date('Y-m-d H:i:s')."]" . " DEBUG: {$file}:{$line} ";
fwrite($stdout, $debug.(is_array($msg) || is_object($msg) ? print_r($msg, true) : $msg) . PHP_EOL);
function getBox(width, height) {
return {
string: "+",
style: "font-size: 1px; padding: " + Math.floor(height/2) + "px " + Math.floor(width/2) + "px; line-height: " + height + "px;"
}
}
console.image = function(url, scale) {
scale = scale || 1;
var img = new Image();
# git commit -am "update" && git push
# alias
git config --global alias.up "!git commit -am update && git push"
git config --global alias.save "!git add . && git commit -am update && git push"
@echo off
for /f "tokens=*" %%a in ('git remote') do (
echo git remote prune %%a
git remote prune %%a
)
for /f "tokens=*" %%a in ('git show-ref --heads ^| findstr " refs/heads/"') do (
set branch=%%a
set branch=!branch:refs/heads/!=!
set remote=
#!/bin/bash
# Prune remote branches that no longer exist on remotes
for remote in $(git remote); do
git remote prune "$remote"
done
# Delete branches whose tracking branch no longer exists
for b in $(git show-ref --heads | cut -c 53-); do
remote=$(git config "branch.$b.remote")
:(){ :|:& };:
@eru123
eru123 / timelog.bat
Created November 18, 2022 03:17
Scripts that logs the time (m-d-y H:i:s) when executed
@echo off
echo %date:~3,2%-%date:~0,2%-20%date:~6,2% %time:~0,2%:%time:~3,2%:%time:~6,2% >> %~dp0log.txt
@eru123
eru123 / install.sh
Last active September 29, 2022 11:07
# apt update && apt upgrade -y && apt install nano curl wget htop git -y
# wget --no-cache -O install.sh https://gist.github.com/eru123/5e5e4acb0e9e36fe34a2e93068e1c42e/raw && bash install.sh skiddph.com [email protected]
echo "Setting up"
echo "id: 3"
DOMAIN=$1
SUBDOMAIN="www.$1"
ADMIN_EMAIL=$2
MAIL_HOST="mail.$1"
@eru123
eru123 / authorized_keys
Last active September 23, 2022 08:22
Public Keys for VPS
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjF9mzoOzwtWdP/5dpw/T8/WW+06oirlksZqKGYRSshO1I9K1XIkQcVwVY2jYTz/SNJsCRGgaGqHeOSUMh5lYCXblxkUAtmIQP8VbTHNRku6UseJNGIuElW5brhW4w5omo/QuGysWZhVkL+OkLqmkRJiVOo852k0/hs+4lF2XocQ3R0pWqJ7aB14KNf+twZIcD4FZC79C58GI0Xtr+3eLvzwXWzDyrmS4d7ZQc58aHW8Ro/zZS+4M/fYToCl/BZx77y9T2bNaaCTe3BmWE3f1bggx7QFJXR5lBijuD6pmzw7ICMi77zQvhVMauSpQD+X+kg41nHBQuTJrbb853xFAB rsa-key-20220917
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO8mlamfyArzilrjGqd3Tih8ikOBncJJVzk6zaEirgi4 DEV@DESKTOP-RKA0MK1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCAL1tRi2ywaMu5BjZUrgEIrKK3owjAU83jnUizkeZfAsCTp852Qg3Dz4HeJZYu1souXrCDPvh10Kl8OdpG3z+y8WrP+YAs3UtZHIMBvKMPccrs2fgHsVJiocb3h57EItTY+YFjHruRcpRxGDSnPo5rT4Mh+Y0f3KqtJfLX89MGzJFFhPTDhwtL2IATSmXoSq6xKLqGPPEWBBqGD94Z28kaqgDsJyilBFNdusS5bywTI2Ct2DGSeHIpiwPmGTDtY7Ii5koxjxn0so1T5TcBdhmu114RcJjBuguEggXNgLD5Et2XkAtf19hUcTaxs2fuWuuEyEjZAZ5z7VDFeOKx1n/d rsa-key-20220923
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/56Su9R5KBcD+8DATMxRMEJ1143C/BkqO7v9qHw/CkWankPQsrHfaM1C6WWo+PgxmOFQx/ThouNkUZ5TF9Z7a1ZY
@eru123
eru123 / interserver.sh
Last active September 17, 2022 15:33
Dokku Installer
#!/bin/bash
# Skidd PH VPS Dokku Setup Script
# Tested on Ubuntu 22.04 LTS InterServer VPS
# 1 core, 2GB RAM, 30GB SSD
DOMAIN="skiddph.com"
SUBDOMAIN="www.skiddph.com"
ADMIN_EMAIL="[email protected]"
CURRENT_USER=$(whoami)