Skip to content

Instantly share code, notes, and snippets.

@frankIT
frankIT / im-in-class.js
Created December 5, 2024 20:18
Cheats a learning object platform by pretending you're following the lesson.
(function monitorModal() {
let intervalId;
// Request notification permission on start
if (Notification.permission !== 'granted') {
Notification.requestPermission();
}
const watch = async () => {
const modalAlert = document.querySelector('#modalAlert');
@frankIT
frankIT / reloadCookiePolicy.js
Last active June 1, 2023 09:37
Async iubenda reload
// Looking for a way to reload/refresh iubenda asynchronously width a different config?
// Yup, doesn't look like there's any documentation about that, so this might save you some time :)
// Get localized configuration dinamically
window.getIubConf = (lang) => {
if( typeof lang === undefined )
lang = 'en';
// That's the common config as it comes from iubenda, stripped down of all the diffs with the localized ones
@frankIT
frankIT / CSGO-3way.sh
Last active December 7, 2024 21:17
Play Counter Strike Global Offensive in a triple display setup on linux
#!/bin/bash
# Display names
# xrandr | grep connected
LEFT="DP-1"
MIDDLE="eDP-1"
RIGHT="HDMI-2"
# Middle display resolution (native)
@frankIT
frankIT / android_stock_debloat.sh
Last active July 31, 2021 09:34
Uninstall vendor system packages through adb shell
#!/bin/bash
# Uninstall vendor system packages through adb shell.
# Stock ROM Samsung Galaxy J3 - J330F
apps=(
'com.samsung.android.calendar'
'com.google.android.music'
'com.google.android.videos'
'com.microsoft.office.excel'
@frankIT
frankIT / chcodename.sh
Created September 22, 2019 23:13
change distro release codename to all apt config files
#!/bin/bash
for f in $(grep -Ril stretch "/etc/apt/sources.list.d/");
do sudo sed -i 's/stretch/buster/g' "$f";
done;
@frankIT
frankIT / switchphpto
Last active January 22, 2024 11:05
coexistence of multiple php versions on debian stretch
#!/bin/bash
# https://deb.sury.org/
VERSION=$1
# unmount all php apache modules
for version in $(ls /etc/php); do
sudo a2dismod php$version
done
@frankIT
frankIT / webp2png.sh
Last active April 30, 2022 03:46
batch convert webp to jpg
#!/bin/bash
# apt-get install webp
for f in *.webp
do dwebp $f -o "$f.png"
done;
@frankIT
frankIT / videoEdit.sh
Last active November 27, 2017 00:51
no reencoding cli video edit using avconv/ffmpeg
#!/bin/bash
# cut chunk by giving start time and length
avconv -ss 00:02:57.00 -i GP015230.MP4 -t 23 -c copy GP015230[00.02.57.00+23].mp4
# turn video 90° clockwise
avconv -i phenomenoh.mp4 -vf "transpose=1" phenomeno_portrait.mp4
# scale/resize canvas but keep video aspect ratio filling the gaps with black
avconv -i phenomeno.mp4 -vf "scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2" phenomeno_canvas_portrait_720.mp4
@frankIT
frankIT / videoCheck.sh
Created November 23, 2017 01:15
loop avprobe on a folder to check for potentially corrupted video
#!/bin/bash
# ...let's say you just copied tons of your gopro video from a faulty sd :)
for f in `ls *.MP4`; do
avprobe -loglevel error "$f"
#ffprobe -loglevel error "$f"
done
@frankIT
frankIT / isViewport.js
Created October 15, 2016 22:40
Just a JS function to check if the viewport matches the guessed bootstrap grid option.
/*
* Just a JS function to check if the viewport matches the guessed bootstrap grid option.
* It uses the modern matchMedia object passing the same media query that bootstrap use, in both v3 or 4.
* Otherwise falls back using the standard window object.
* I often saw using the screen object for the same purpose,
* but it behaves strangely in extended desktop layouts with multiple monitors.
* Note that window.innerWidth instead, should not be used from within frames.
*/
function isViewport(bsSelector)