Skip to content

Instantly share code, notes, and snippets.

View dionedomingo's full-sized avatar
🎯
Focusing

Dione Domingo dionedomingo

🎯
Focusing
View GitHub Profile
@dionedomingo
dionedomingo / pre-commit
Last active April 25, 2024 10:37
Run code formatter before commit
#!/bin/bash
# add this in your repo at .git/hooks/pre-commit
formatter="./bin/code-formatter.sh" # your formatter script.
# Check if formatter exists
if ! command -v "$formatter" &> /dev/null; then
echo "Error: Formatter '$formatter' not found."
exit 1
#!/bin/bash
ps -A --sort -rss -o comm,pmem,rss | awk '
NR == 1 { print; next }
{ a[$1] += $2; b[$1] += $3; }
END {
for (i in a) {
size_in_bytes = b[i] * 1024
split("B KB MB GB TB PB", unit)
human_readable = 0
if (size_in_bytes == 0) {
@dionedomingo
dionedomingo / pollute-my-mac.sh
Last active May 12, 2021 12:42
macos awscli awsume packer watch tfswitch
installDebug=false
function caskInstall() {
INSTALLSERVICE=$1
if brew info --cask $INSTALLSERVICE | grep "Not installed" > /dev/null; then
echo "installing $INSTALLSERVICE ..."
brew install --cask $INSTALLSERVICE
brew link --overwrite $INSTALLSERVICE 2>/dev/null 1>/dev/null
elif [ $installDebug = true ]; then
brew info --cask $INSTALLSERVICE
fi
@dionedomingo
dionedomingo / git.md
Last active March 16, 2021 06:45
Git

Repository contributors

git shortlog -sne
@dionedomingo
dionedomingo / orderassistent_helper.xml
Last active November 30, 2020 08:57
Iposen CodeSniffer Codeing standard ruleset for VSCode and PHPStorm S
<?xml version="1.0"?>
<ruleset name="OrderAssistent">
<rule ref="Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore"></rule>
<rule ref="Squiz.Formatting.OperatorBracket.MissingBrackets"></rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.NoSpaceAfterComma"></rule>
</ruleset>
<?php
$filename='database_backup_'.date('G_a_m_d_y').'.sql';
$result=exec('mysqldump database_name --password=your_pass --user=root --single-transaction >/var/backups/'.$filename,$output);
if($output==''){
echo "done";
/* no output is good */
}
@dionedomingo
dionedomingo / getallheaders.php
Created June 26, 2020 07:49
get all headers jwt_token
<?php
if (!function_exists('getallheaders'))
{
function getallheaders()
{
$headers = [];
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
@dionedomingo
dionedomingo / country-flags.json
Created March 24, 2020 15:31
Countries Flags JSON
{
"Andorra": {
"flag": "🇦🇩",
"code": "AD"
},
"United Arab Emirates": {
"flag": "🇦🇪",
"code": "AE"
},
"Afghanistan": {
@dionedomingo
dionedomingo / README.md
Last active February 25, 2020 08:19
GitFlow + JIRA GITHUB + Development tools