Skip to content

Instantly share code, notes, and snippets.

Avatar

Keaton Burleson 128keaton

View GitHub Profile
@128keaton
128keaton / chip-list-autocomplete-fix.directive.ts
Created Apr 14, 2021
Material Chip List Autocomplete Fix Directive
View chip-list-autocomplete-fix.directive.ts
import {AfterContentInit, ContentChild, Directive, QueryList, ViewContainerRef} from '@angular/core';
import {MatAutocompleteTrigger} from '@angular/material/autocomplete';
import {MatChip, MatChipList} from '@angular/material/chips';
/**
* This directive fixes the Material Chip List Autocomplete issue where if you click an option in the autocomplete menu,
* the panel doesn't return unless you click out and click back in again.
*
* Keaton Burleson
@128keaton
128keaton / mad-mac.sh
Created Jan 28, 2021
Mac scripts for disabling nanny stuff, automating setup, etc.
View mad-mac.sh
#!/bin/bash
#### DISABLE SECURITY STUFF
### DISK IMAGE VERIFICIATION
# https://apple.stackexchange.com/questions/370202/how-do-i-skip-verification-of-a-dmg-file
# Disable the "Are you sure you want to open this application?" dialog
View led-tool
# 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"
View ListNodeIterator.java
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);
@128keaton
128keaton / README.md
Last active Nov 8, 2019
Small scripts I use to run IntelliJ IDEA inside of WSL2 with an X11 server
View README.md

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
View et-write.sh
#!/bin/bash
## INCORRECT
$(top -bn1 | grep load | awk '{printf"%.2f%%\t\t\n", $(NF-2)}')
@128keaton
128keaton / output.shell
Last active Sep 17, 2019
Prints HDD/Memory Usage (bash)
View output.shell
--------------------------------------------------|Usage|--------------------------------------------------
Memory Usage: [###############-------------------------] 38% (372M/962M, 194M available)
Disk Usage: [##########------------------------------] 26% (5G/19G, 13G available)
-----------------------------------------------------------------------------------------------------------
View RoundedThings.swift
class CentralMenuButton: UIButton {
var label: UILabel?
var labelText: String!
var labelColor: UIColor!
var labelFont: UIFont!
var labelAlignment: NSTextAlignment!
override init(frame: CGRect) {
@128keaton
128keaton / flashScreen.swift
Created Aug 29, 2019 — 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.
View flashScreen.swift
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 {
View debug macos
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>