Skip to content

Instantly share code, notes, and snippets.

View abaines's full-sized avatar

Alan Baines abaines

View GitHub Profile
// Tutorial: Lead
// Destroy the enemy ship. Its position is given by the "target" function and velocity by the
// "target_velocity" function. Your ship is not able to accelerate in this scenario.
//
// This is where the game becomes challenging! You'll need to lead the target
// by firing towards where the target will be by the time the bullet gets there.
//
// Hint: target() + target_velocity() * t gives the position of the target after t seconds.
//
// You can scale a vector by a number: vec2(a, b) * c == vec2(a * c, b * c)
@abaines
abaines / gist:b0125210b27aec8933a3e78806ea4074
Created October 7, 2024 14:15
Factorio Make Anything Machine Blueprint string
0eNrNWVtu4zYU3UrAz0Ia6GHJDyAF+lX0Y1YwMARaZmwiEqkhKSdGkAV0H11ZV9JL6i1LtiUHxWCADC2Rh/fNw6sPtEtykgnKFNp8IBpzJtHmxweS9MBwop8xnBK0QYLveMaFQp8WomxP3tHG/bQGJmIpSbpLKDvYKY6PlBHbay3yPrcWIkxRRUmxlflxjlie7ogAVKvekvzMiVRE2PER/kcWyriEdZzp7QDL/xZY6Iw2trf4FsAW5YLohSawSupZksR6QbFTJbeF6hmdp+W+Mc8y2DRLsCKw6c8cJyAgvGBcpKCrBTPSDAusOMiLns2DXFtwGXxu4Z+2S08rr0bf5cmrTZkkAiS4phOMhpD8GknmO6mwWXsBY1co7hDGosbYk5jutYV5uqPMaHSJ5ZdYjrHynorCqAYHIkYJnkQ7csQnqg3yUYFG8G5PS/N/oPYvMPsLFeCqJnzUOdMCnahQuTFypaWZYROIJR1GHdP/jnQ08VxluerH7d142Tky7oteBE8jygALbV5wIol25YD1glakMPAAUzfMV7vU7RvQ9YYt2ITtvBDGsORE7EzwU+HeMoEmxHKgNa+StgbOIL2/ErkVzTAPH8ijgItWor28PC5gcKUczYR0nZbShCRz8Pw2XuN3CasSO8Fp9oB4jbexoOqYEkXjboRPQPbayP71ujMXtvG5JAlkC/8i3FuJPhc3bNKJv4ER5BtVUI0mAbptwGUDKPhB4DTFu4TYMiP4lTwi6apxGJVwIJ7tDDOSzEf0mlhVAlNmQ9pn8zX3mlgFtMQuy/80PKcN6HcB46MR8lFY32mVkQxTYBc4fp2vt9+YMcvTBwzoN6GTwxNxEDBnb+9IMrEgrdo1uFVBhtjg/OLuXwP2HwAOW/6Jz3EyPWuAiGjjZfD8O2Td0x/srECsw9P3Qjw0wibCm9W2zye8MTYxQsca3B4jm0nBgJAAzPR1HFh1QVc3yEYVb5uO0xY7YkS9cfFq9BFkjzZK5ES7ghBW0bieyJdrzLR6kUb4HPT
@abaines
abaines / control.lua
Last active November 9, 2024 17:50
Factorio space-age: Fix starting map settings
local handler = require("event_handler")
handler.add_lib(require("freeplay"))
if script.active_mods["space-age"] then
handler.add_lib(require("space-finish-script"))
else
handler.add_lib(require("silo-script"))
end
@abaines
abaines / roll20.js
Last active July 29, 2023 06:46
roll20 storage sorter
let t = { "KB":1, "MB":1000};
function c(a,b)
{
return a.size-b.size;
}
$('.library-container').map( function(cb,el,index){
var c31 = el.children[3].children[1];
if (!c31){
@abaines
abaines / hashSearch.py
Created November 6, 2020 23:04
Search for duplicate files
import os
import sys
import hashlib
print('cwd',os.getcwd())
def hashFile(f):
return hashlib.sha224(open(f,'rb').read()).hexdigest()
@abaines
abaines / dishonored.py
Last active November 6, 2020 23:09
Detect quick saves in Dishonored
import os.path
import os
import threading
import hashlib
import shutil
import winsound
quickSaveFileName = 'quicksave.fos'
@abaines
abaines / TeamChanneling.py
Created November 6, 2020 22:47
Kantora Team Channeling Dice Roller
import random
import math
def r(v):
return random.randint(1, v)
def good():
return [r(12),r(12),r(2)]
@abaines
abaines / saver.py
Created November 6, 2020 22:43
Detect Introversion\Prison Architect autosave.prison
# Alan Baines
import os.path
import os
import threading
import hashlib
import shutil
import winsound
import time
import glob
@abaines
abaines / YouTube Music Volume Reducer.js
Last active September 29, 2020 23:07
Reduce YouTube Music volume below 5%
javascript:(function(){
window.__iwm = true;
const e = document.querySelector("#movie_player > div.html5-video-container > video");
const v = e.volume;
const n = v < 0.015 ? 0.05 : v - 0.01;
e.volume = n;
if (!window.__kv) {
console.clear();
e.addEventListener("volumechange", function(){
document.querySelector("#movie_player > div.html5-video-container > video").volume = window.__kv;
rem for ian