Skip to content

Instantly share code, notes, and snippets.

Copy and past the following code in your bookmark toolbar

javascript:var videos=document.getElementsByTagName("video");for(vid in videos)videos[vid].src&&videos[vid].webkitSetPresentationMode("picture-in-picture");
@funkyremi
funkyremi / netflix-captions-vtt.js
Last active October 14, 2024 15:05
Display Netflix Captions in PiP mode
// Hit refresh when playing a Netflix video and paste the following code in your console.
// This script will replace the native captions by WebVTT captions that will work in PiP mode.
// Use the code here to trigger PiP in safari: https://gist.github.com/funkyremi/9d7b70285282d532c3f8c964810e7bf9
const lang = 'fr';
const hideNetflixCaptions = (() => {
const style = document.createElement("style");
style.type = "text/css";
const hideCc = ".player-timedtext {display: none !important;}";
# Get remaining battery time
pmset -g batt|grep remaining|cut -d" " -f1,5
# Update Database (for locate)
sudo /usr/libexec/locate.updatedb
@funkyremi
funkyremi / get-dom-element-promise.js
Last active September 30, 2019 12:44
Function that wait for an element to exist in DOM then return it.
export function getDomElement(selector = '', timeoutMs = 1000, pollIntervalMs = 10) {
const timeStart = performance.now();
return new Promise((resolve, reject) => {
const intervalId = setInterval(() => {
const timeNow = performance.now();
const element = document.querySelector(selector);
if (element) {
clearInterval(intervalId);
resolve(element);
} else if ((timeNow - timeStart) > timeoutMs) {
@funkyremi
funkyremi / network-monitor.sh
Created December 21, 2020 16:51
Reconnect to wifi or ethernet when down
#!/bin/bash
LOGFILE=/var/log/network-monitor.log
if /sbin/ifconfig eth0 | grep -q "inet"; then
echo "$(date "+%m %d %Y %T") : Ethernet OK"
else
echo "$(date "+%m %d %Y %T") : Ethernet connection down! Attempting reconnection." >>$LOGFILE
/sbin/ifconfig eth0 up
OUT=$?
@funkyremi
funkyremi / docker-compose.yml
Created January 19, 2021 20:23
Wordpress docker compose file
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
ports:
- 3306:3306