Skip to content

Instantly share code, notes, and snippets.

View eviltester's full-sized avatar

Alan Richardson eviltester

View GitHub Profile
@eviltester
eviltester / gist:d2742f4ccddb2ece0e6ad232fe6f4489
Created June 17, 2023 18:10
xtype bot and supporting functions
ig.game.crosshair.update = function(){
    this.currentAnim.angle -= 3 * ig.system.tick;
}
function hackMoveCrossHairToBaddy(){
    var num_baddies = ig.game.entities.length;
    for(var x=0;x<num_baddies;x++){
@eviltester
eviltester / gist:7d8dc6e3665e038772ea8be1e5c3af98
Created September 1, 2021 12:19
Automatically Create a Markdown TOC for current page
var output="";
document.querySelectorAll("h2,h3,h4,h5").forEach((element) => {
var headingNum = element.tagName.toLowerCase().replace('h','');
var indent = (parseInt(headingNum)-2)*3;
var spaces= indent>0 ? Array(indent).fill(' ').join('') : '';
var href= element.id ? element.id : element.innerText.toLowerCase().replaceAll(" ","-")
output+=spaces + "- [" + element.innerText +"](#" + href + ")\n" })
console.log(output);
@eviltester
eviltester / gist:ac7ed61c589855c7d35fe56e6718cc77
Created September 1, 2021 12:15
Calculate average number of views for a YouTube channel's visible videos
const viewCounts = [...document.querySelectorAll('div#metadata-line span:first-child')].map((node) => {viewCount = node.innerText.replace(" views","");valueOfViewCount = viewCount.indexOf("K")==-1 ? parseInt(viewCount,10) : parseFloat(viewCount)*1000; return valueOfViewCount;});
console.log(viewCounts);
const sum = viewCounts.reduce(( previousValue, currentValue ) => previousValue + currentValue);
console.log(`${sum} / ${viewCounts.length}`);
console.log(sum/viewCounts.length)
@eviltester
eviltester / closeAllDoors.js
Last active January 5, 2021 16:44
Challenge 13 of the 12 Days of TestMas 2020 challenge
var _0x2014=['class','div.door','27DvQMlz','323835EbRkHy','236136uYgZaz','data-date','2022/12/12','removeAttribute','988067lbpwFN','181827nlOrMb','785308bizyhW','querySelectorAll','1DhEcvB','div.door\x20a','forEach','setAttribute','1010029ZNxBZi','13133dzTUde'];var _0x29e1=function(_0x2c1487,_0x3e2de6){_0x2c1487=_0x2c1487-0x10b;var _0x20149e=_0x2014[_0x2c1487];return _0x20149e;};var _0x3b985f=_0x29e1;(function(_0xe08d5a,_0x2ed766){var _0x5a9c86=_0x29e1;while(!![]){try{var _0x208977=-parseInt(_0x5a9c86(0x112))*parseInt(_0x5a9c86(0x11b))+parseInt(_0x5a9c86(0x118))+parseInt(_0x5a9c86(0x117))+parseInt(_0x5a9c86(0x119))+parseInt(_0x5a9c86(0x113))+parseInt(_0x5a9c86(0x111))*-parseInt(_0x5a9c86(0x10e))+-parseInt(_0x5a9c86(0x10d));if(_0x208977===_0x2ed766)break;else _0xe08d5a['push'](_0xe08d5a['shift']());}catch(_0x10ce15){_0xe08d5a['push'](_0xe08d5a['shift']());}}}(_0x2014,0x7ac63),document[_0x3b985f(0x11a)](_0x3b985f(0x110))[_0x3b985f(0x10b)](_0x10bccc=>{var _0x1412a1=_0x3b985f;_0x10bccc[_0x1412a1(0x10c)](_0x1412a1
@eviltester
eviltester / gist:5fb355076c11c9eed8ef0a56a96971f7
Created June 23, 2020 13:11
some example page scraping examples and output to console using JavaScript
document.querySelectorAll("tbody tr td[style*='15px']").forEach(function(item, index){console.log(item.innerText)})
document.querySelectorAll("tbody tr td[style*='15px']").forEach(function(item, index){console.log("<option value='" + item.innerText + "'>" + item.innerText + "</option>")})
document.querySelectorAll("tbody tr td[style*='15px']").forEach(function(item, index){console.log("\"" + item.innerText + "\", ")})
@eviltester
eviltester / format web pages for readability
Created June 16, 2020 17:35
right click, inspect, find <body>, paste this into the element style
color: black !important;
background: white !important;
font-size: 2em !important;
font-family: sans-serif !important;
// find the text line in a feed item e.g. [person] commented on this
window.setInterval(function(){
Array.from(document.querySelectorAll("div.feed-shared-text-view > span > span")).forEach(function(item){
if(item.innerText.endsWith(" this") || item.innerText.endsWith(" this insightful")){
// mark it for ignoring and the parent for deletion
item.className="IGNORE";
item.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display="none";
item.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.className="DELETEENTRY";
}});},100)
@eviltester
eviltester / gist:42de6e41d2d1cdd591be0fc024f10920
Created May 28, 2020 17:35
play tic tac toe org random bot
// https://playtictactoe.org/
function playGame(){
var restart = document.querySelector("div.restart");
if(restart.style.display=="block"){
restart.click()
}else{
var squares = document.querySelectorAll("div.square > div:not(.x):not(.o)");
var item=Math.floor(Math.random()*squares.length)
// http://zzzscore.com/1to50/en
function clickAllSquares(){
var clickedCount=0;
for(currentNum=1;currentNum<51;currentNum++){
console.log("processing "+currentNum);
cells = document.querySelectorAll("div#grid div");
for(var cellindex=0;cellindex<cells.length;cellindex++){
var foundInt = parseInt(cells[cellindex].innerText);
if(foundInt==currentNum){
// http://zzzscore.com/1to50/en
function clickAllSquares(){
var clickedCount=0;
for(currentNum=1;currentNum<51;currentNum++){
console.log("processing "+currentNum);
cells = document.querySelectorAll("div#grid div");
for(var cellindex=0;cellindex<cells.length;cellindex++){
var foundInt = parseInt(cells[cellindex].innerText);
if(foundInt==currentNum){