Skip to content

Instantly share code, notes, and snippets.

View Shujito's full-sized avatar
🗿
yes the whole earth

Alberto Ramos Shujito

🗿
yes the whole earth
View GitHub Profile
@Shujito
Shujito / restore-hosts.sh
Created August 28, 2023 05:57
Update/Restore unified hosts file.
if [ -s /etc/hosts.bak ]; then
echo '[ Restoring your original hosts file ]'
sudo mv /etc/hosts.bak /etc/hosts
echo '[ Done! ]'
else
echo '[ There is nothing to do... ]'
fi
@Shujito
Shujito / canvas.html
Last active July 15, 2023 04:50
Ejemplo Canvas HTML5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html {
height: 100%;
display: flex;
align-items: center;
@Shujito
Shujito / toh264.sh
Created March 4, 2020 19:47
convert videos to h264 baseline profile level 3.0
#/bin/sh
if ! [ "$1" ];
then
echo "where file"
exit
fi
filename="${1%.*}"
extension="${1##*.}"
@Shujito
Shujito / TextWatcherAdapter.java
Created October 9, 2019 23:19
Utilidad para usar TextWatcher como lambda en TextView::addTextChangedListener
public interface TextWatcherAdapter extends TextWatcher {
enum Action {
beforeTextChanged,
onTextChanged,
afterTextChanged
}
default void beforeTextChanged(CharSequence s, int start, int count, int after) {
this.action(Action.beforeTextChanged, s, start, count, after);
}
@Shujito
Shujito / adb-uninstall.sh
Last active March 7, 2019 01:47
uninstall android app from all connected devices and emulators
#/bin/sh
for DEVICE in $(adb devices | grep device$ | awk '{print $1}');
do
for APP in $(find . -maxdepth 3 -type f | grep build\.gradle | xargs cat | grep applicationId | awk '{print $2}');
do
RESULT=$(echo $APP | xargs -I _ adb -s $DEVICE uninstall _ 2>/dev/null);
if [ "$RESULT" == "Success" ]; then
echo "Uninstalled $APP from $DEVICE"
fi
done;
if [ $1 ]; then FILENAME=$1; else exit; fi
BASENAME=$(basename -- $FILENAME)
NAME=${BASENAME%.*}
convert $FILENAME -auto-orient +profile "*" -write \
"mpr:source" -resize "1080x1080^" -gravity center -crop "1080x1080+0+0" +repage -write "$NAME-1080.jpg" +delete \
"mpr:source" -resize "720x720^" -gravity center -crop "720x720+0+0" +repage -write "$NAME-720.jpg" +delete \
"mpr:source" -resize "540x540^" -gravity center -crop "540x540+0+0" +repage -write "$NAME-540.jpg" +delete \
"mpr:source" -resize "360x360^" -gravity center -crop "360x360+0+0" +repage -write "$NAME-360.jpg" +delete \
@Shujito
Shujito / bookmarklets.md
Last active February 9, 2024 21:37
Useful bookmarklets

Useful Bookmarklets

How to use:

Create a bookmark and replace URL with either of the listed codes

Easier: (google chrome)

  • Triple click to the whole thing
  • COPY!
  • Now hit [CTRL] + [D]
@Shujito
Shujito / spotihosts
Last active November 29, 2023 06:56
The hosts file entries to block Spotify audio ad servers.
# taken from here:
# https://www.reddit.com/r/Piracy/comments/4kn6rq/comprehensive_guide_to_blocking_ads_on_spotify/
0.0.0.0 adclick.g.doublecklick.net
0.0.0.0 adeventtracker.spotify.com
0.0.0.0 ads-fa.spotify.com
0.0.0.0 analytics.spotify.com
0.0.0.0 audio2.spotify.com
0.0.0.0 b.scorecardresearch.com
0.0.0.0 bounceexchange.com
0.0.0.0 bs.serving-sys.com
@Shujito
Shujito / imgurer.lua
Created November 15, 2016 07:09
imgur permutator
local fiveChars = ... or 'weiss'
--print('chars:', fiveChars:lower())
local function bitSet(number, offset)
local nro = bit32.rshift(number, offset)
local nroa1 = bit32.band(nro, 1)
--print('nroa1', nroa1)
return nroa1 ~= 0
end
@Shujito
Shujito / configuration.sh
Last active November 8, 2016 19:46
useful stuff for servers
# basic debian vps setup (configurations and security)
#################
## root config ##
# change root password
passwd
# fix locales (e.g. "Setting locale failed" messages)
locale-gen en_US.UTF-8
dpkg-reconfigure locales