Skip to content

Instantly share code, notes, and snippets.

View pwndev's full-sized avatar
🚀
Let's gooo

Dillan pwndev

🚀
Let's gooo
View GitHub Profile
@pwndev
pwndev / timeFormatting.js
Last active September 18, 2021 22:47
"Advanced" time formatting
timeSincePost(date) {
let diff = Math.floor((new Date() - date) / 1000);
if (diff <= 1) return "just now";
if (diff < 20) return diff + " seconds ago";
if (diff < 60) return "less than a minute ago";
if (diff <= 3540) return Math.round(diff / 60) + " min ago";
if (diff <= 5400) return "1 hour ago";
if (diff <= 86400) return Math.round(diff / 3600) + " hours ago";
if (diff <= 129600) return "1 day ago";
if (diff < 604800) return Math.round(diff / 86400) + " days ago";
@pwndev
pwndev / updateChecker.js
Created September 27, 2021 18:09
A JavaScript function to check for newer versions using GitHub releases.
/**
* This checks for newer releases on GitHub. If any newer versions can be found, it returns a promise resolving as the latest version tag. Otherwise the promise resolves as null.
* @param {String} releaseTag The release tag of the code you implement this into.
* @param {String} repo The repository containing the code.
* @returns A Promise, resolving as the version tag if the provided release tag doesn't match the one provided on GitHub.
*/
const checkIfOutdated = (releaseTag, repo) => new Promise(async (resolve, reject) => {
const releases = await fetch(`https://api.github.com/repos/${repo}/releases`).then(res => res.json());
if(!Array.isArray(releases)) return reject();
const latestRelease = releases[0];
@pwndev
pwndev / git-import-cheatsheeet.md
Last active December 8, 2021 08:40
Cheatsheet to create or import existing repositories

Create new local repository and push to origin

echo "# Title" >> README.md
git init
git add README.md
git commit -m "Initial commit"
git branch -M main
git remote add origin git@github.com:<user/orga>/<repo>.git
git push -u origin main
@pwndev
pwndev / minecraft-server.sh
Created January 22, 2022 13:13
A script to start and manage a Minecraft server with screen.
# TODO
@pwndev
pwndev / password-typer.py
Created February 25, 2022 08:41
Types your password if an app doesn't allow pasting
#############################
# pip3 install pyautogui #
# python3 password-typer.py #
#############################
import sys
import time
import pyautogui
if(len(sys.argv) != 2):
print("Run: python3 " + sys.argv[0] + " <your password>")
@pwndev
pwndev / powershell-typer.ps1
Created June 12, 2022 12:39
This script allows you to type/paste text into input fields that prevent text pasting
$wshell = New-Object -ComObject wscript.shell;
Sleep 3
$wshell.SendKeys('YOUR MESSAGE HERE')
@pwndev
pwndev / html-plain-text-match.regexp
Last active November 28, 2022 12:34
Need to match plain text between html tags? Good to find hard-coded translations in jsx for example. Doesn't work in 100% of the cases but matches most of them:)
<.*>[^<>{}]+<\/.*>
@pwndev
pwndev / rename-js-jsx.py
Created January 17, 2023 12:42
Simple script to rename React .js files that render jsx to .jsx
import os
import re
root_dir = "src"
JSX_REGEX = r"<\w+"
for dirpath, dirnames, filenames in os.walk(root_dir):
for filename in filenames:
if filename.endswith(".js"):
@pwndev
pwndev / fuck-ytshorts.ubfilter
Created March 9, 2024 23:48
Make youtube.com a bit more clean and useful
www.youtube.com##ytd-reel-shelf-renderer
www.youtube.com##ytd-video-renderer:has([overlay-style="SHORTS"])