Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Quickly display the output from various ESXi disks.
# Until I get feedback, this is going to be a dirty to write it. Should work?
#
# File syntax for the drive listing should look something like this -
# DRIVE NAME = DRIVE ID
# The '=' is important as that's the sepperator for the variables.
while true
do
@scar45
scar45 / gpio-button-listener
Created February 8, 2015 02:56
A Python script which is intended to be run as a background process, and listens for + takes action on GPIO button 17, 22, and 23 presses.
#!/usr/bin/env python2.7
# original script by Alex Eames http://RasPi.tv
# http://RasPi.tv/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio-part-3
# Modified by George Merlocco http://github.com/scar45
# for Adafruit 2.2" LCD Pi Hat tactile button inputs
import RPi.GPIO as GPIO
import time
import sys
@scar45
scar45 / retropie-motd
Last active August 29, 2015 14:16
RetroPie stats shown after logging in
# RETROPIE PROFILE START
# Thanks to http://blog.petrockblock.com/forums/topic/retropie-mushroom-motd/#post-3965
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=$(printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs")
@scar45
scar45 / ascii-xubuntu
Created March 1, 2016 13:05
ascii-xubuntu
c1=$(getColor 'light blue')
startline="0"
fulloutput=(
"${c1} %s"
"${c1} l: %s"
"${c1} .:l: Xl lk %s"
"${c1} .:' NMMMK ,M; .KX. %s"
"${c1} dMMM0. WMMMM; dW ;WX. %s"
"${c1} OMMMMN.xMMMMl 0o ;MO %s"
"${c1} ;MMMMMXkMMMMKdlc;'. . dl %s"
@scar45
scar45 / r-doom-subreddit.css
Created March 31, 2016 18:47
r-doom-subreddit.css
/*
/r/Doom Stylesheet by scar45 (03/2016)
An updated version of the /r/Doom style, which aims to bring in influence from the old and new Doom series of amazing games.
Colour scheme has been designed to resemble fire and blood (red and orange) sitting on top of a dark theme, since Doom is, you know, dark.
Older, sprite-based elements from the original games adorn the left side of the UI, where newer bits from Doom (2016) are inlayed to the right.
I hope you enjoy this, and if you have any feedback, please toss me a PM @ /u/scarFortyFive
@scar45
scar45 / logcat.txt
Created May 26, 2016 04:10
aokp mm bt buffer underruns
05-26 00:01:58.323 D/bt_btif (5669): A2DP-CTRL-CHANNEL EVENT UIPC_RX_DATA_READY_EVT
05-26 00:01:58.323 D/bt_btif (5669): a2dp-ctrl-cmd : A2DP_CTRL_CMD_START
05-26 00:01:58.324 D/bt_btif (5669): btif_dispatch_sm_event: event: 26, len: 0
05-26 00:01:58.324 D/bt_btif (5669): btif_av_state_opened_handler event:BT
05-26 00:01:58.324 D/bt_btif (5669): a2dp-ctrl-cmd : A2DP_CTRL_CMD_START DONE
05-26 00:01:58.324 D/bt_btif (5669): a2dp-ctrl-cmd : A2DP_CTRL_CMD_START DONE
05-26 00:01:58.325 D/bt_btif (5669): btif_media_thread_handle_cmd : 5 BTIF_MEDIA_SBC_ENC_INIT
05-26 00:01:58.325 D/bt_btif (5669): btif_media_thread_handle_cmd: BTIF_MEDIA_SBC_ENC_INIT DONE
05-26 00:01:58.325 D/bt_btif (5669): btif_media_thread_handle_cmd : 11 BTIF_MEDIA_AUDIO_FEEDING_INIT
05-26 00:01:58.325 D/bt_btif (5669): btif_media_thread_handle_cmd: BTIF_MEDIA_AUDIO_FEEDING_INIT DONE
@scar45
scar45 / rambox-custom-badge.js
Created November 23, 2016 05:36
Rambox Custom Badge Code
function checkUnread() {
var e = document.getElementsByClassName("mx_RoomTile_badge");
var t = 0;
for(i = 0; i < e.length; i++) {
if (parseInt(e[i].textContent.trim()) % 1 === 0 ) {
t += parseInt(e[i].textContent.trim());
}
}
updateBadge(t);
}
@scar45
scar45 / bash-var-thru-curl.sh
Created November 23, 2016 06:27
Send a bash variable through a cURL post
#!/bin/bash
header="Content-Type: application/json"
FILENAME="/media/file.avi"
request_body=$(< <(cat <<EOF
{
"jsonrpc": "2.0",
"method": "Player.Open",
"params": {
"item": {
"file": "$FILENAME"
@scar45
scar45 / scar45-old-tv.cfg
Last active September 5, 2024 08:48
RetroArch Old School TV Overlay
# scar45's 1986 Retro Hitachi TV Overlay for Retroarch
# https://gist.github.com/scar45/6a0048f3af5a4d02ceb157a4bca03467
#
# Download the actual retro TV image from -- https://i.imgur.com/QY0X5S4.png
# then rename it to "scar45-old-tv.png" and place it beside this file, under
# the main Retroarch 'overlay'/'overlays' folder.
#
# Retroarch Onscreen Display --> Onscreen Overlay Settings
#
# Display Overlay == ON