Skip to content

Instantly share code, notes, and snippets.

View badvision's full-sized avatar

Brendan Robert badvision

View GitHub Profile
@badvision
badvision / gen_gradient_images.sh
Created January 25, 2024 18:47
Create random images
#!/bin/bash
for (( i=1; i<=500; i++ ))
do
# Generate a random filename
filename="random_image_${i}.png"
# Use ImageMagick to create a random 100x100 pixel image
color1=$(shuf -e $(convert -list color | grep srgb | cut -d' ' -f1) | head -1 | tr [:upper:] [:lower:])
color2=$(shuf -e $(convert -list color | grep srgb | cut -d' ' -f1) | head -1 | tr [:upper:] [:lower:])
@badvision
badvision / lemonade_stand.bas
Created July 24, 2015 07:38
Lemonade stand (Applesoft basic)
1 LOMEM: 14080
5 GOSUB 10000: GOSUB 11000: GOSUB 16000: GOTO 135
10 REM <<< LEMONADE STAND >>>
15 REM
20 REM FROM AN ORIGINAL PROGRAM
30 REM BY BOB JAMISON, OF THE
40 REM MINNESOTA EDUCATIONAL
50 REM COMPUTING CONSORTIUM
60 REM * * *
70 REM MODIFIED FOR THE APPLE
@badvision
badvision / reloadOnLayerSwitch.js
Last active May 17, 2021 14:09
AEM 6.x: Reload the page when the user switches layers
// This must be in a client library with the category cq.authoring.editor.hook
/* global Granite, jQuery, document */
(function ($, channel) {
'use strict';
$(function () {
var loadedTime = new Date();
channel.on('cq-layer-activated', function (event) {
if (event.prevLayer && event.layer !== event.prevLayer) {
var eventTime = new Date();
if (event.prevLayer !== 'Annotate' && event.layer !== 'Annotate' && (eventTime - loadedTime) > 1500) {
*= $6000;
!cpu 65c02;
PLOT = $F800
CLEARSCR= $F832
SETCOLOR= $F864
LORES = $C056
GFX = $C050
CURRENT = $0
lda LORES
@badvision
badvision / README.md
Last active February 1, 2019 04:56
SCRIPT-8
@badvision
badvision / README.md
Created January 30, 2019 21:58
SCRIPT-8
@badvision
badvision / webserver.ino
Created October 16, 2018 15:55
ESP32 Webserver Example for OLED
#include <string>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include "SSD1306.h"
#define SDA 4
#define SCL 15
#define RST 16 //RST must be set by software
@badvision
badvision / sessionSummary.groovy
Created February 9, 2016 23:30
Summarize all open JCR sessions by the stack trace of the code that opened them. This helps identify session leaks in code.
import groovy.json.JsonSlurper
//Get data from here: /system/sling/monitoring/mbeans/org/apache/jackrabbit/oak/%2522SessionStatistics%2522.2.json
def file = '/Users/brobert/Desktop/all_sessions.json' as File
def sanitizeStacktrace = {trace->
if (trace.contains("loginAdministrative")) {
def lines = trace.split("\n")
def startIdx;
for (def idx=0; idx < lines.length; idx++) {
@badvision
badvision / update_retroarch_playlists.groovy
Created September 4, 2017 06:36
Update RetroArch playlist files with missing roms
import java.util.zip.*
// Update these two lines to match the location of your playlists and what extensions to skip
playlistDir = "C:\\Users\\brobert\\AppData\\Roaming\\RetroArch\\playlists" as File
ignoreExtensions="cht|clt|sav|dtc|txt|html"
def appendPlaylist(playlistFile, path) {
println("Appending ${path}")
// Mac | Linux users change this to forward slash, I could have used the path separator property but I was lazy.
name = path.substring(path.lastIndexOf('\\')+1)
BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB
BB BB 2 B2 B2 B2 B2 B2 2 BB BB B2 B2 2 B B 2 BB B BB 2 B2 B2 B2 B2 B2 2 BB BB
BB BB 2 BB 2 2 2 BB 2 BB B B2 2 2 B B B2 BB B BB 2 BB 2 2 2 BB 2 BB BB
BB BB 2 BB B2 B2 B2 BB 2 BB B2 B 2 BB 2 B2 B BB B2 BB 2 BB B2 B2 B2 BB 2 BB BB
BB BB B2 B2 B2 B2 B2 B2 B2 BB B2 B B2 BB B2 BB 2 B 2 BB B2 B2 B2 B2 B2 B2 B2 BB BB
BB BB B2 2 B BB BB B2 B2 B2 BB B2 2 BB BB 2 B B B B BB B 2 2 B B BB BB BB
BB BB B2 B B B2 BB B2 B2 BB 2 B2 B BB B B2 2 2 B B B2 B2 BB 2 BB B2 2 BB BB
BB BB 2 2 B2 B2 B 2 B2 B BB B2 2 B B 2 BB B 2 B B2 2 BB BB BB B B2 BB BB
BB BB 2 BB 2 B BB B B2 B 2 2 B2 BB B2 BB 2 B2 2 B2 2 BB B B2 B B2 2 BB BB
BB BB B2 BB B2 B2 BB BB B2 B2 2 BB 2 B B B2 B BB 2 B2 B2 B2 2 BB 2 BB BB BB BB