Skip to content

Instantly share code, notes, and snippets.

View seleb's full-sized avatar
👁️

Sean S. LeBlanc seleb

👁️
View GitHub Profile
@seleb
seleb / guy juicer 1.js
Created June 16, 2021 15:50
the original guy juicer
/**
* Helper used to replace code in a script tag based on a search regex.
* To inject code without erasing original string, using capturing groups; e.g.
* ```js
* inject(/(some string)/,'injected before $1 injected after');
* ```
* @param searcher Regex to search and replace
* @param replacer Replacer string/fn
*/
function inject(searcher, replacer) {
@seleb
seleb / guy juicer 2.js
Created June 16, 2021 04:01
for juicing guys
const shader = `
precision mediump float;
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform float time;
uniform vec2 resolution;
const float PI = 3.14159;
vec2 uBufferSize = vec2(128, 128);
//https://stackoverflow.com/questions/12964279/whats-the-origin-of-this-glsl-rand-one-liner
float rand(vec2 co){
@seleb
seleb / readme.txt
Created December 25, 2020 21:22
Escape the Grill (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@seleb
seleb / gb-webglazy.js
Last active November 27, 2020 08:46
🐦 gb webglazy snippet
const img = document.querySelector('img');
const size = [img.width, img.height];
const options = {
background: 'black',
scaleMode: 'MULTIPLES',
allowDownscaling: true,
disableFeedbackTexture: false,
scaleMultiplier: 8,
fragment: `
precision mediump float;
@seleb
seleb / zonebot.js
Last active November 22, 2020 22:14
simple client for zone usable from console as a bot
// avatar utils (mostly copied from blitsy)
function encodeM1(pixels) {
var pixels32 = new Uint32Array(pixels);
var data = new Uint8ClampedArray(Math.ceil(pixels32.length / 8));
for (var i = 0; i < data.length; ++i) {
var byte = 0;
for (var bit = 0; bit < 8; ++bit) {
byte <<= 1;
byte |= pixels32[i * 8 + (7 - bit)] > 0 ? 1 : 0;
}
@seleb
seleb / itch get collection urls.js
Created July 4, 2020 07:30
itch sort collection
async function getCollectionUrls(collectionName) {
// find collection
const collection = Array.from(document.querySelectorAll('.game_collection')).find(i => {
const titleEl = i.querySelector('.collection_title_wrap');
return titleEl && titleEl.innerText.toLowerCase() === collectionName.toLowerCase();
});
if (!collection) {
throw new Error(`Could not find collection "${collectionName}`);
}
@seleb
seleb / CJK wrap.css
Created April 23, 2020 19:25
CJK wrap rules CSS
[lang='zh-CN'],
[lang='zh-Hant'],
[lang='ko'],
[lang='ja'] {
word-break: keep-all;
overflow-wrap: break-word;
}
@seleb
seleb / roll20 map save.js
Last active October 29, 2024 15:21
script for exporting roll20 maps to an image
/**
script for exporting roll20 maps to an image
how to use:
1. open your roll20 game to the page you want to save
2. open your browser's developer tools
3. copy-paste this entire file in the console
4. hit enter
5. wait for map to save and appear in top-left
6. right-click -> save as... to export
@seleb
seleb / canvas replacement textbox mask.js
Created December 20, 2019 06:28
extension to canvas replacement bitsy hack which adds an `isTextBox` helper for keeping text legible with shader effects
import bitsy from 'bitsy';
import { inject } from '@bitsy/hecks/src/helpers/kitsy-script-toolkit';
import {
hackOptions as canvasReplacement
} from '@bitsy/hecks/src/canvas replacement';
canvasReplacement.glazyOptions.fragment = `
precision mediump float;
uniform sampler2D tex0;
uniform sampler2D tex1;
function wait(t) {
return new Promise(resolve => setTimeout(resolve, t));
}
const tracks = Array.from(document.querySelectorAll(".trackManagerTrackList__item"));
for (track of tracks) {
const moreBtn = track.querySelector('.sc-button-more');
moreBtn.click();
await wait(500 + Math.random(500));
const downloadBtn = document.querySelector('.sc-button-download');