Skip to content

Instantly share code, notes, and snippets.

View willnaoosmith's full-sized avatar
🐧
Torvalds take the wheel 🙏🏻

William Brochensque Júnior willnaoosmith

🐧
Torvalds take the wheel 🙏🏻
View GitHub Profile
@willnaoosmith
willnaoosmith / gist:162751af85027a4c7ad74a90eaa344bc
Last active August 24, 2023 11:23
run command progmatically without using crontab
watch -n seconds -x command
Example:
watch -n 1 -x \ date >> testfile.txt
const sleep = time => new Promise(res => setTimeout(res, time, "done sleeping"));
sleep(2000).then(msg => console.log(msg));
@willnaoosmith
willnaoosmith / Appx-Uninstaller.ps1
Created August 9, 2023 10:12 — forked from ThioJoe/Appx-Uninstaller.ps1
A basic script for uninstalling a list of app packages in Windows 10/11, including those pre-installed with Windows
# A basic script for uninstalling app packages in Windows 10/11, including those pre-installed with Windows
#
# Note: If you get an error about the script not being allowed to run, the below command will change the execution polciy temporarily for one session only:
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
#
# To execute the script, open a Powershell window to the directory with the script and run the following command using your scripts file name (and don't forget the .\ )
# .\WhateverScriptName.ps1
# -------------------------------------------------------------------------------------------
# Script by ThioJoe - https://github.com/ThioJoe
@willnaoosmith
willnaoosmith / gist:89a5aa7ef04b00accca090958c696d6d
Created August 8, 2023 11:59
run function after user ends tryping on input
[...]
super(props)
this.timeout = 0
[...]
this._sampleFunction = this.sampleFunction.bind(this)
[...]
@willnaoosmith
willnaoosmith / gist:8e5916f28d58afc2a69af4e73035fc84
Created July 26, 2023 14:54
HTML code to redirect to another page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0; URL=https://yourNewURLHere" />
</head>
</html>
@willnaoosmith
willnaoosmith / gist:40aac70c8a944f3167083781ce553148
Created July 25, 2023 10:27
remove videos from youtube watch later
setInterval(function () {
video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];
video.querySelector('#primary button[aria-label="Action menu"]').click();
var things = document.evaluate(
'//span[contains(text(),"Remove from")]',
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
@willnaoosmith
willnaoosmith / scroll loop.js
Created July 21, 2023 12:50
Code to create a loop for multiple vertical scroll div's with multiple items inside.
//This code was made for a suitable use-case of mine. It will require code changes for your use-case.
//This code makes so every 10 seconds, the vertical scroll div goes down an item at time.
sleep(5000).then(() => {
let views = document.getElementsByClassName("arrayOfVerticalDivsToCreateAnScrollLoopEffect")
for(let view in views){
view = views[view]
this._createScroll(view)
}
})
@willnaoosmith
willnaoosmith / gist:39d9bd0b88a5e94edd940450302af625
Created July 19, 2023 11:40
Opens firefox and focus on it.
/usr/lib/firefox/firefox; sleep 0.2; wmctrl -ia $(wmctrl -l Firefox | grep "Mozilla Firefox" | sort -r | head -n 1 | cut -d " " -f 1)
@willnaoosmith
willnaoosmith / gist:a711b62bd9b303ab7c1416d8938cfab1
Created July 18, 2023 17:53
Get every day of the current week using javascript
let curr = new Date()
let first = curr.getDate() - curr.getDay() + 1
let monday = new Date(curr.setDate(first))
let sunday = new Date(curr.setDate(monday.getDate() + 6))
const daysOfTheWeek = []
for (let date = monday; date <= sunday; date.setDate(date.getDate() + 1)){
const day = new Date(date.valueOf())
daysOfTheWeek.push(day)
}
@willnaoosmith
willnaoosmith / gist:bfaa32603d0410fc649ddabea3819c46
Last active July 10, 2023 17:11
javascript regexp Only text and accents
string.replace(/[-{}/:><=+_'"|.;,?%0-9!@#$¨&*()]/, '')