javascript:var videos=document.getElementsByTagName("video");for(vid in videos)videos[vid].src&&videos[vid].webkitSetPresentationMode("picture-in-picture");
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
version: '3.3' | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql | |
restart: always | |
ports: | |
- 3306:3306 |
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 | |
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=$? |
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
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) { |
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
# Get remaining battery time | |
pmset -g batt|grep remaining|cut -d" " -f1,5 | |
# Update Database (for locate) | |
sudo /usr/libexec/locate.updatedb |
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
// Paste the following code in your developer console | |
var canvas = document.createElement('canvas'); | |
var theVideo = document.querySelector('video'); | |
canvas.width = theVideo.videoWidth; | |
canvas.height = theVideo.videoHeight; | |
canvas.getContext('2d').drawImage(theVideo, 0, 0, theVideo.videoWidth, theVideo.videoHeight); | |
var png = canvas.toDataURL('image/png'); | |
var link = document.createElement('a'); | |
link.href = png; | |
link.setAttribute('download', 'capture.png'); |
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
// Auto scroll to Github best comment | |
// Choose one of the following method (Bookmark toolbar link or Browser console) | |
// Minified code (drag and drop to your bookmarks) | |
javascript:var bestCommentId;var bestScore=0;Array.from(document.querySelectorAll(".js-targetable-comment")).forEach(item=>{if(item.querySelector("button.reaction-summary-item")){let commentScore=0;Array.from(item.querySelectorAll("button.reaction-summary-item")).forEach(i=>{if(!!i.innerText){commentScore+=Number(i.innerText.replace(/\D/g,''))}});if(commentScore>bestScore){bestScore=commentScore;bestCommentId=item.id}}});console.log('Comment score',bestScore);location.href=`#${ bestCommentId }`; | |
// Original code (copy paste in your browser console) | |
var bestCommentId; | |
var bestScore = 0; | |
Array.from(document.querySelectorAll(".js-targetable-comment")).forEach(item => { |
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
const codes = [ | |
{ | |
name: 'Action & Adventure', | |
code: '1365', | |
}, | |
{ | |
name: 'Action Comedies', | |
code: '43040', | |
}, | |
{ |
NewerOlder