Skip to content

Instantly share code, notes, and snippets.

View badvision's full-sized avatar

Brendan Robert badvision

View GitHub Profile
@badvision
badvision / publish renditions.jsp
Last active May 19, 2016 20:04
Publish non-original renditions to another instance, using multiple publish queues in round-robin fashion
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"
import="java.util.*,
com.adobe.acs.commons.fam.*,
com.adobe.acs.commons.functions.*,
com.adobe.granite.asset.api.*,
com.day.cq.replication.*,
org.apache.sling.api.resource.*,
javax.jcr.*"%><%
ActionManagerFactory amf = sling.getService(ActionManagerFactory.class);
@badvision
badvision / regenerate thumbnails.jsp
Created May 19, 2016 20:12
Regenerate thumbnails using synthetic workflow
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"
import="com.adobe.acs.commons.workflow.synthetic.*,
com.adobe.acs.commons.fam.*,
com.adobe.acs.commons.functions.*,
org.apache.sling.api.resource.*,
java.util.*,
javax.jcr.*,
com.day.cq.search.*,
com.day.cq.dam.commons.util.DamUtil,
@badvision
badvision / all ips.jsp
Created May 19, 2016 20:17
List all IP Addresses that the server is listening on.
<%@page session="false" contentType="text/html; charset=utf-8"
import="java.util.*,java.net.*"%><%
List<NetworkInterface> ifaces = Collections.list(NetworkInterface.getNetworkInterfaces());
for(NetworkInterface ifc : ifaces) {
if(ifc.isUp()) {
List<InetAddress> addrs = Collections.list(ifc.getInetAddresses());
for(InetAddress addr : addrs) {
%>
<%=addr.getHostAddress()%><br>
@badvision
badvision / disk usage.jsp
Last active May 19, 2016 20:29
Call the *nix command line "df -h" to obtain the disk usage of the server
<%@page session="false" contentType="text/html; charset=utf-8"
pageEncoding="UTF-8" import="java.lang.*,java.io.*"%><%
Process p = Runtime.getRuntime().exec("df",new String[]{"-h"});
p.waitFor();
%><h2>STDERR:</h2><pre><%
String line;
BufferedReader error = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while((line = error.readLine()) != null){
%><%=line%>
<%
@badvision
badvision / fix_surfacebook_audio.bat
Created November 8, 2016 19:53
When resuming from standby on a Surfacebook, HDMI audio becomes unavailable. Get devcon.exe from Microsoft's driver dev toolkit and run this bat script (as administrator!) to disable/enable the audio device.
cd "\Program Files (x86)\Windows Kits\10\Tools\x64"
devcon disable IntelAudio*8086*
devcon enable IntelAudio*8086*
@badvision
badvision / atari_diag_lines.a
Last active December 30, 2016 06:47
Makes a trippy diagonal line pattern on the VCS
; use with 8bitworkshop's VCS IDE
; http://8bitworkshop.com/?platform=vcs
processor 6502
; Include files for Atari 2600 constants and handy macro routines
include "vcs.h"
include "macro.h"
org $f000
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
@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)
@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 / README.md
Created January 30, 2019 21:58
SCRIPT-8