Skip to content

Instantly share code, notes, and snippets.

View eru123's full-sized avatar

Jericho Aquino eru123

View GitHub Profile
@eru123
eru123 / nginx
Created November 29, 2023 01:16
View nginx
upstream uri_phpmyadmin { server phpmyadmin:80; }
upstream uri_skiddph_prod { server skiddph-prod:80; }
upstream uri_skiddph_dev { server skiddph-dev:80; }
upstream uri_skiddph_dev_main { server skiddph-dev:3000; }
upstream uri_skiddph_uat { server skiddph-uat:80; }
upstream uri_scholarship_gemma { server gemma-scholarship-dev:80; }
upstream uri_jmlumaday { server jmlumaday-dev:80; }
upstream uri_codehubph { server codehubph:3000; }
upstream uri_homepage { server homepage:3000; }
View mnet
#!/bin/bash
# get script path
script_dir=$(dirname $(realpath $0))
# script_dir=/home/jericho
# current month
# Ym=$(date +"%Y%m")
# DB PATH
View cfban
cfuser=<Your Cloudflare Account Email Address>
cftoken=<Cloudflare Global API KEY>
# get arg
arg1=$1
arg2=$2
# if $arg1 is not equal to unban, and arg1 is not empty
if [ "$arg1" != "unban" ] && [ -n "$arg1" ]; then
# get ip
@eru123
eru123 / microbench.php
Created September 18, 2023 01:58 — forked from nikic/microbench.php
Microbenchmark of generator implementation
View microbench.php
<?php
error_reporting(E_ALL);
function xrange($start, $end, $step = 1) {
for ($i = $start; $i < $end; $i += $step) {
yield $i;
}
}
View composer install
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
@eru123
eru123 / vane1.cpp
Last active September 4, 2023 14:48
View vane1.cpp
#include <iostream>
using namespace std;
int main()
{
double interestRate = 0.0152;
double netBalance = 0, payment = 0, interest = 0,
d1 = 0, d2 = 0, averageDailyBalance = 0;
cout << "*************************************" << endl;
cout << "* Name: Vanessa Mae Abare *" << endl;
View git-switcher.bat
@ECHO OFF
setlocal enabledelayedexpansion
@REM store users in a variable, manually
@REM user 1
set user[0]=<github username>
set email[0]=<your email>
set pass[0]=<github token>
set signkey[0]=<gpg token if exists>
View gist:df609c9a4572a9427569409bee77fbea
@echo off
setlocal EnableDelayedExpansion
set ports=%*
if "%ports%"=="" (
echo Usage: %0 <Local Port 1>:<Server Port 1> [<Local Port 2>:<Server Port 2> ...]
exit /b 1
)
@rem ssh account
@eru123
eru123 / usePersistentData.js
Created July 18, 2023 09:51
A Vue 3 composable that can persist state with localStorage
View usePersistentData.js
import { reactive, watch, toRef } from "vue"
const state = reactive({})
export const usePersistentData = (key, defaultValue) => {
if (state[key]) {
const data = toRef(state, key)
watch(data, () => {
window.localStorage.setItem(key, JSON.stringify(data.value))
}, { deep: true })
View git-switcher.bash
#!/bin/bash
# Git Account Switcher
# Example usage: sudo ./git-switcher.bash <git username here>
user=$1
declare -i iuser=0
declare -a users
declare -a emails
declare -a passwords
declare -a signkeys