View custom-keyring-batch.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for KEY in $(apt-key --keyring /etc/apt/trusted.gpg list | grep -E "(([ ]{1,2}(([0-9A-F]{4}))){10})" | tr -d " " | grep -E "([0-9A-F]){8}\b" ); do K=${KEY:(-8)}; apt-key export $K | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/imported-from-trusted-gpg-$K.gpg; done |
View arrayMapRecursive.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types=1); | |
/** | |
* @param array $array | |
* @param callable $callback | |
* @param bool $values_only = true | |
* | |
* @return array | |
*/ | |
public function arrayMapRecursive(array $array, callable $callback, bool $values_only = true): array |
View github-ssh.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install: | |
# wget https://gist.githubusercontent.com/eusonlito/39f15118cfa7a3fcab88cc80b4ef7ca8/raw/github-ssh.sh -O /usr/local/bin/github-ssh | |
# chmod 755 /usr/local/bin/github-ssh | |
# Usage: | |
# github-ssh "https://github.com/eusonlito/Password-Manager" | |
url="$1" |
View oppo-coloros-bloatware-disable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pm disable-user --user 0 com.caf.fmradio | |
pm disable-user --user 0 com.coloros.activation | |
pm disable-user --user 0 com.coloros.activation.overlay.common | |
pm disable-user --user 0 com.coloros.alarmclock | |
pm disable-user --user 0 com.coloros.appmanager | |
pm disable-user --user 0 com.coloros.assistantscreen | |
pm disable-user --user 0 com.coloros.athena | |
pm disable-user --user 0 com.coloros.avastofferwall | |
pm disable-user --user 0 com.coloros.backuprestore | |
pm disable-user --user 0 com.coloros.backuprestore.remoteservice |
View randomize-numbers-html.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll('body *').forEach(function (e) { | |
const html = e.innerHTML; | |
if (!html || !html.match(/^[0-9\-\.\,\s]+$/)) { | |
return; | |
} | |
const chars = html.split(''); | |
for (i = 0; i < chars.length; i++) { |
View svg2png.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for svg in */*.svg; do | |
width=$(grep -m 1 -o -h 'width="[0-9]\+"' $svg | sed 's/[^0-9]//g') | |
height=$(grep -m 1 -o -h 'height="[0-9]\+"' $svg | sed 's/[^0-9]//g') | |
png=$(echo $svg | sed 's/svg/png/') | |
echo "Converting $svg to $png with size ${width}x${height}" | |
inkscape -w "$width" -h "$height" $svg -o $png 2>/dev/null |
View factorial-attendance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function(){ | |
const endpointShifts = 'https://api.factorialhr.com/attendance/shifts'; | |
const endpointPeriods = 'https://api.factorialhr.com/attendance/periods'; | |
const year = new Date().getFullYear(); | |
const month = new Date().getMonth() + 1; | |
const times = [[ '08:00', '14:00' ], [ '15:30', '17:30' ]]; | |
const allowFuture = true; |
View convert-jpg-png.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [ "$1" == "" ] || [ ! -d "$1" ]; then | |
echo "Invalid Path $1" | |
exit 1 | |
fi | |
LC_NUMERIC="en_US.UTF-8" |
View array-keys.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('array_keys_whitelist')) { | |
function array_keys_whitelist(array $array, array $whitelist): array | |
{ | |
return array_intersect_key($array, array_flip($whitelist)); | |
} | |
} | |
if (!function_exists('array_keys_blacklist')) { |
View mysql-database-user.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE `DB` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
CREATE USER "USR"@"localhost" IDENTIFIED BY "PWD"; | |
CREATE USER "USR"@"127.0.0.1" IDENTIFIED BY "PWD"; | |
GRANT ALL ON `DB`.* TO "USR"@"localhost"; | |
GRANT ALL ON `DB`.* TO "USR"@"127.0.0.1"; | |
FLUSH PRIVILEGES; |
NewerOlder