Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Richardson eviltester

View GitHub Profile
@eviltester
eviltester / gist:65d6f47950699646c8e2cb0fe382b4fe
Last active Aug 16, 2017
run bookmarklet on http.cat to link page to httpstatuses.com
View gist:65d6f47950699646c8e2cb0fe382b4fe
javascript:(function(){var%20cats=document.querySelectorAll(%22li.status%22);%20for%20(var%20i%20=%200,%20len%20=%20cats.length;%20i%20%3C%20len;%20i++)%20%7B%20cats%5Bi%5D.innerHTML%20+=%20%22%5Binfo%5D%22.link(%22https://httpstatuses.com/%22+cats%5Bi%5D.innerText);%20%7D})()
View gist:076b8e52a9b3c0bb3868a0ec6150c860
var zTypeBotAlphaChars = "abcdefghijklmnopqrstuvwxyz";
var zTypeBotCharToType = 0;
ztypebot = setInterval(function() {
ig.game.shoot(
zTypeBotAlphaChars.charAt(zTypeBotCharToType));
zTypeBotCharToType = (zTypeBotCharToType +1)%26;
}
, 100);
@eviltester
eviltester / gist:f4b01d0b900cd4cbf64426f86c48a291
Created Dec 11, 2017
Create Data in TodoMVC BackBone app
View gist:f4b01d0b900cd4cbf64426f86c48a291
for (x = 0; x < 100; x++) {
app.todos.create({
title: "todo ".concat(x),
order: app.todos.nextOrder(),
completed: false
})
}
@eviltester
eviltester / gist:8405b63339acdf61a68bb8c128815c97
Created Dec 11, 2017
Delete Todo Items in the TodoMVC application
View gist:8405b63339acdf61a68bb8c128815c97
for (x = app.todos.models.length - 1; x >= 0; x--) {
app.todos.models[x].destroy()
}
@eviltester
eviltester / gist:c29f2add0fc713a5185261a3f11a00fc
Created Aug 16, 2018
find a bunch of stuff on the page and click on them
View gist:c29f2add0fc713a5185261a3f11a00fc
var divs = document.querySelectorAll('.button'); [].forEach.call(divs, function(div) { div.click();});
View gist:83ba5cb1e3f4b2766bb176b9b84449d5
ffmpeg -i original.mp4 -vcodec h264 -acodec aac compressed.mp4
@eviltester
eviltester / gist:7beef92896fdd8b638656f996fac38c0
Last active Apr 12, 2021
Convert videos into subtitled sections using ffmpeg
View gist:7beef92896fdd8b638656f996fac38c0
# Create a new caption file
~~~~~~~~
ffmpeg -i captions.srt captions.ass
~~~~~~~~
# Add subtitles to main video without changing it
~~~~~~~~
ffmpeg -i video.mp4 -vf "subtitles=captions.ass:force_style='OutlineColour=&H80000000,BorderStyle=4,Outline=1,Shadow=0,MarginV=20'" subtitled-video.mp4
View gist:0b5c1289263d31cd5305fb70985c2d8f
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.concurrent.TimeUnit;
View gist:d25f0d0cbfcd66ddd9f05bd70ef06cd5
var scrollyText="Li4uLi4uLi4uLi4uLi4uLi4uLi4uLiNUaGFua1lvdVBhdHJvbnMuLi4uLi4uLi4uLi4uLi4uLiBZZXMgaXQgaXMgTm92ZW1iZXIgMTl0aCAyMDE4IGFuZCB0aGF0IG1lYW5zIGl0IGlzLi4uICdUaGFuayBZb3UgUGF0cm9ucyBkYXknLiBBbmQgSSBkbyB3YW50IHRvIHRoYW5rIHlvdSBmb3IgYWxsIHlvdXIgc3VwcG9ydCBhbmQgcXVlc3Rpb25zLiBZb3UncmUgaGVscGluZyBtZSBleHBsb3JlIGFuZCB0aGluayBkaWZmZXJlbnRseSBhYm91dCBTb2Z0d2FyZSBUZXN0aW5nIGFuZCBEZXZlbG9wbWVudCBldmVyeSBkYXkuIE1hbnkgVGhhbmtzLCBBbGFuLi4uLg==";
function scrolly(len, locator){
var t = atob(scrollyText);
document.querySelector(locator).innerText=t.substring(0,len);
t = t.substring(1)+t.substring(0,1);
scrollyText = btoa(t);
}
var scrollyBot = setInterval(function(){scrolly(50,"span[data-tag='post-title']")},150);
@eviltester
eviltester / gist:dd242b5fed697cf3fe91a86a25fd5ab9
Last active Dec 6, 2018
How long is a course on zenler?
View gist:dd242b5fed697cf3fe91a86a25fd5ab9
var times = document.getElementsByClassName("curr-time");
var totaltime= 0;
for (var i = 0, len = times.length; i < len; i++) {
time = document.getElementsByClassName("curr-time")[i].innerText.trim();
if(time.length>0){
var b = time.split(':');
console.log(b);
seconds = (Number(b[0])*60) + (Number(b[1]));
totaltime+=seconds;
}