Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am krmax44 on github.
  • I am krmax44 (https://keybase.io/krmax44) on keybase.
  • I have a public key whose fingerprint is ED54 CB31 C56C 04BD 8DB9 2014 5C49 9A4F 4EC4 EE03

To claim this, I am signing this object:

@krmax44
krmax44 / script.js
Created September 12, 2019 19:03
Remove all videos from YouTube Watch Later playlist
/*
go to https://www.youtube.com/playlist?list=WL&disable_polymer=true
or any other YouTube playlist - but make sure to be on the old interface
scroll all the way to the bottom and load in all playlist items
then open up the developer console (Ctrl + Shift + I)
and paste the following snippet
*/
(async () => {
for (const e of $$('.pl-video-edit-remove')) {
@krmax44
krmax44 / index.js
Last active September 4, 2019 14:10
Get a random German city.
#!/usr/bin/env node
const axios = require('axios');
const sparqlQuery = `SELECT ?itemLabel
WHERE
{
?item wdt:P31 wd:Q1549591.
?item wdt:P17 wd:Q183.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
@krmax44
krmax44 / homework.js
Last active May 30, 2019 22:29
Capture The Flag At UCF - Scripting Repetition solution with Node.js
const net = require('net');
const client = new net.Socket();
const math = require('mathjs'); // requires mathjs package!
client.connect(10104, 'ctf.hackucf.org');
client.on('data', data => {
const text = data.toString();
const flag = /flag{.*}/gm.exec(text);
@krmax44
krmax44 / longestWords.js
Created October 8, 2018 18:06
Horribly inefficient solution, but it's only one line of code!
// words.txt: https://github.com/dwyl/english-words/blob/master/words.txt
// see this video for why this exists: https://www.youtube.com/watch?v=zp4BMR88260
console.log(require('fs').readFileSync('words.txt').toString().split('\n').filter(word => /^[abcdefhijlnoprstu\-y. ]*$/.test(word.toLowerCase())).sort((a,b) => a.length < b.length ? 1 : -1)[0]);
// output: dichlorodiphenyltrichloroethane
@krmax44
krmax44 / Mockify-dist.js
Last active November 22, 2017 09:11
Mockify everything.
/*
Mockify text on the fly with this small script
How to use: Create a new bookmark in your browser, name it Mockify or something and as URL paste the following:
Click on the bookmark, enter your text and it will copy your mockified text to your clipboard.
*/
javascript:(function(){ var input = prompt("Mockify:", ""); var out = ""; for (i = 0; i < input.length; i++) { if (i % 2) { out += input[i].toUpperCase(); } else { out += input[i].toLowerCase(); } } var tbx = document.createElement('input'); document.body.appendChild(tbx); tbx.value = out; tbx.focus(); tbx.setSelectionRange(0, tbx.value.length); document.execCommand("copy"); document.body.removeChild(tbx); })();