Skip to content

Instantly share code, notes, and snippets.

View 128keaton's full-sized avatar

Keaton Burleson 128keaton

View GitHub Profile
@128keaton
128keaton / navigation.js
Last active September 21, 2018 20:29
Client-side javascript that fetches menus from a Wordpress instance for another website.
// -------------------------------------------------------------
// Add page items
// (uses Wordpress plugins JSONMenu)
// -------------------------------------------------------------
$.ajax({
url: 'http://wp.dev.reviveit.io/?rest_route=/menus/v1/list',
dataType: 'application/json',
cache: 'true',
complete: function (data) {
console.log('Ajax request success');
2019/04/12 14:08:06:389 macOS Utilities-v2.65-b2
2019/04/12 14:08:06:389
2019/04/12 14:08:06:389
---------------------------LOGGER INITIALIZED---------------------------
2019/04/12 14:08:06:389
2019/04/12 14:08:06:389 Library folder does not exist at '/Users/admin/Library/Application Support/ER2/'
2019/04/12 14:08:06:389 Creating folder at path '/Users/admin/Library/Application Support/ER2/'
2019/04/12 14:08:06:390 Library folder exists at '/Users/admin/Library/Application Support/ER2/'
2019/04/12 14:08:06:390 Property list does not exist at '/Users/admin/Library/Application Support/ER2/com.er2.applications.plist'
2019/04/12 14:08:06:390 Copying property list from bundle
Last login: Fri May 10 14:02:39 on ttys000
FusionDriveiMac:~ admin$ /usr/sbin/diskutil cs list -plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CoreStorageLogicalVolumeGroups</key>
<array>
<dict>
<key>CoreStorageLogicalVolumeFamilies</key>
@128keaton
128keaton / flashScreen.swift
Created August 29, 2019 01:46 — forked from bgreenlee/flashScreen.swift
Flashing the screen in Swift. Sticking this here because it took me a while to work out the right variable types and casting.
func flashScreen() {
let inDuration: CGDisplayFadeInterval = 0.0
let outDuration: CGDisplayFadeInterval = 1.0
let color = NSColor.white
var fadeToken: CGDisplayFadeReservationToken = 0
let colorToUse = color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)!
let err = CGAcquireDisplayFadeReservation(inDuration + outDuration, &fadeToken)
if err != CGError.success {
class CentralMenuButton: UIButton {
var label: UILabel?
var labelText: String!
var labelColor: UIColor!
var labelFont: UIFont!
var labelAlignment: NSTextAlignment!
override init(frame: CGRect) {
@128keaton
128keaton / output.shell
Last active September 17, 2019 22:15
Prints HDD/Memory Usage (bash)
--------------------------------------------------|Usage|--------------------------------------------------
Memory Usage: [###############-------------------------] 38% (372M/962M, 194M available)
Disk Usage: [##########------------------------------] 26% (5G/19G, 13G available)
-----------------------------------------------------------------------------------------------------------
#!/bin/bash
## INCORRECT
$(top -bn1 | grep load | awk '{printf"%.2f%%\t\t\n", $(NF-2)}')
@128keaton
128keaton / README.md
Last active November 8, 2019 16:00
Small scripts I use to run IntelliJ IDEA inside of WSL2 with an X11 server

1. Create ramdisk in /etc/fstab:

Open up a shell instance editing /etc/fstab:

$ sudo nano /etc/fstab

Inside the editor, append the following to create a new ramdisk. Adjust the 1024M segment to whatever size you want your ramdisk to be.

tmpfs /tmp/ramdisk tmpfs noexec,defaults,noatime,size=1024M,x-gvfs-show,mode=1777 0 0
public static void iterateListData(ListNode listNode) {
ListNode currentList = listNode;
int nestLevel = 0;
while (currentList != null ){
StringBuilder nestIndicator = new StringBuilder("→");
for (int i = 0; i < nestLevel; i++) {
nestIndicator.append("→");
}
System.out.println(nestIndicator + " data = " + currentList.data);
# vi /sbin/led-tool
#!/bin/bash
# Shamelessly stolen from https://community.ui.com/stories/Repurposing-a-second-UniFi-Cloud-Key-as-a-DNS-Recursor-Radius-and-NTP-server/56605e0f-401f-4397-8c05-5b1cbe118bf6
if [ "$1" == "blue" ]; then
echo "Enabling steady blue LED"
echo 0 > /sys/class/leds/ubnt:white:dome/brightness
cat /sys/class/leds/ubnt:blue:dome/max_brightness > /sys/class/leds/ubnt:blue:dome/brightness
elif [ "$1" == "white" ]; then
echo "Enabling flashing white LED"