Skip to content

Instantly share code, notes, and snippets.

View met4000's full-sized avatar

Nathan Townshend met4000

  • University of Western Australia, Perth, Western Australia
View GitHub Profile
@met4000
met4000 / coolc.js
Created September 12, 2021 17:31
coolc_assembley_compiler
var iMap = Object.fromEntries([
"halt",
"nop",
"add",
"sub",
"mult",
"div",
"call",
"return",
"jmp",
@met4000
met4000 / __echoUtil__speed__.js
Last active June 15, 2020 09:17
A bookmarklet to add extra speed options to the echo player (supports x0-16, up to a reasonable number of decimal places)
if (!window.__echoUtil__speed__) {
window.__echoUtil__speed__ = {};
__echoUtil__speed__.createOptionEl = function (speed) {
var optionEl = document.createElement("option");
optionEl.value = speed;
optionEl.text = optionEl.value;
return optionEl;
};
@met4000
met4000 / bookmarklet.js
Last active May 12, 2019 02:59
Duke-of-Ed hours counting bookmarklet
for(var el=document.getElementsByClassName("_177ZgO_Z8JZy-fXhmTlSfO"),t=0,a=0;a<el.length;a++){var h=/(\d+)h (\d+)min/.exec(el[a].getElementsByClassName("_1DFESbLyOveW60ihEafsZr")[1].children[0].innerHTML);t+=parseInt(h[1])+parseInt(h[2])/60}alert(t+" hours done, averaging "+parseInt(t/parseInt(/Completed (\d+) h/.exec(document.getElementsByClassName("qa1iBqTdHVMA1IjYvmNIs")[0].innerText)[1])*1e4)/1e4+" per week");
javascript:(function()%7Bif%20(window.location.href%20!%3D%20%60https%3A%2F%2Fforms.office.com%2FPages%2FResponsePage.aspx%3Fid%3D-RaA4P3Ru0yDsLdutDYWJyLhcRrucO1Jit25a6tks7hUQUpJRlFZRkhaVUlSSEpQRTRMQUE2WVQzUi4u%60)window.location.href%3D%60https%3A%2F%2Fforms.office.com%2FPages%2FResponsePage.aspx%3Fid%3D-RaA4P3Ru0yDsLdutDYWJyLhcRrucO1Jit25a6tks7hUQUpJRlFZRkhaVUlSSEpQRTRMQUE2WVQzUi4u%60%3Bwindow.b%20%3D%201%3Bwindow.g%20%3D%202%3Bwindow.press%3Dfunction(xpath)%20%7Bvar%20obj%20%3D%20document.evaluate(xpath%2C%20document%2C%20null%2C%20XPathResult.ANY_TYPE%2C%20null).iterateNext()%3Bif%20(!obj)%20return%20false%3Bobj.click()%3Breturn%20true%3B%7D%3Bwindow.setAsTop%3Dfunction(n%2C%20s)%20%7Bfor%20(var%20i%20%3D%20n%3B%20i%20%3E%201%3B%20i--)%7Bpress(%22%2Fhtml%2Fbody%2Fdiv%2Fdiv%2Fdiv%2Fdiv%2Fdiv%2Fdiv%2Fdiv%5B1%5D%2Fdiv%5B2%5D%2Fdiv%5B2%5D%2Fdiv%5B%22%20%2B%20(1%20%2B%20s)%20%2B%20%22%5D%2Fdiv%5B2%5D%2Fdiv%5B3%5D%2Fdiv%5B%22%20%2B%20i%20%2B%20%22%5D%2Fdiv%2Fdiv%2Fbutton%5B1%5D%22)%3B%7D%7D%3Bpress(%22%2Fhtml%2
@met4000
met4000 / cs.js
Last active September 1, 2017 07:16
Best JS Code Ever
(function(){function i(e){for(var n=0,e=e.children;n<e.length;n++)t.push(e[n].tagName.toLowerCase()),e[n].childElementCount?i(e[n]):t.indexOf(e[n].tagName.toLowerCase())}var t=[];i(document.body),t.forEach(function(e){var t=document.createElement("style");t.innerHTML=e+"{font-family:'Comic Sans MS'!important}",document.head.append(t)});}())
@met4000
met4000 / cookie clicker bookmarklet
Last active May 6, 2020 05:40
An autoclick bookmarklet for CC.
#include <iostream>
using namespace std;
int main()
{
string from, to, disp, v;
int value;
bool a = true;
do {
cout << "What would you like to convert from?" << endl << ">>";
cin >> from;
@met4000
met4000 / calc.min.c
Last active November 12, 2016 15:11
#include <iostream>using namespace std;
inline bool isInteger(const std::string & s){   if(s.empty() || ((!isdigit(s[0])) && (s[0] != '-') && (s[0] != '+'))) return false ;
   char * p ;   strtol(s.c_str(), &p, 10) ;
   return (*p == 0) ;}
int main() { string from, to, disp, v; int value; bool a = true;  cout << "What would you like to convert from?" << endl << ">>"; cin >> from; cout << "What would you like to convert to?" << endl << ">>"; cin >> to; cout << "Calculator:" << endl << ">>";  disp = to == "C" ? "Celsius" : to == "F" ? "Fahrenheit" : to == "K" ? "Kelvin" : "N/A";  while (a) {  cin >> v;  if (!isInteger(v)) {   a = false;  } else {   value << (int)v.front();//ERRORS   if (from == "F") {    value = (value - 32)/1.8;   } else if (from == "K") {    value -= 273;   }   if (to == "F") {    value = value * 1.8 + 32;   } else if (to == "K") {    value += 273;   }   cout << value << " degrees " << disp << endl << ">>";  } } a = true;}
@met4000
met4000 / chess.js
Created October 28, 2016 04:13
Chess
document.body.innerHTML = "<img
src='http://www.modchats.com/user/met4000/WedMar919535620161819.png'
style='position: absolute; top: 50%; left: 50%; margin-top: -50px; margin-left: -50px; width: 100px; height: 100px;'
>";
document.title = "Cheeeeeesssssss";
@met4000
met4000 / jsdrc.js
Created June 7, 2016 04:50
Javascript Disable Rightclick
document.onmousedown = function(){};
status = "Right Click Disabled";
document.body.setAttribute("oncontextmenu", "return false");