Skip to content

Instantly share code, notes, and snippets.

View dionedomingo's full-sized avatar
🎯
Focusing

Dione Domingo dionedomingo

🎯
Focusing
View GitHub Profile
#!/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
<?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 / 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>
@dionedomingo
dionedomingo / phpcs_iposen.xml
Created February 5, 2020 13:03
Iposen CodeSniffer Codeing standard ruleset for VSCode and PHPStorm
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_iPosen" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
<description>The PHP_iPosen coding standard builds on the Squiz coding standard.</description>
<!-- Include the whole Squiz standard except FunctionComment, which we override -->
<rule ref="Squiz">
<exclude name="Squiz.Files.FileExtension.ClassFound"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/>
<exclude name="Squiz.Commenting.ClosingDeclarationComment.Missing" />
</rule>
@dionedomingo
dionedomingo / phpcs.xml
Created February 4, 2020 08:40
PHPCS XML
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>The coding standard for PHP_CodeSniffer itself.</description>
<file>autoload.php</file>
<file>bin</file>
<file>scripts</file>
<file>src</file>
<file>tests</file>