Skip to content

Instantly share code, notes, and snippets.

View sneakyness's full-sized avatar
💭
Rolling up to the function like a stretched out Steve Ballmer

Nick Pannuto sneakyness

💭
Rolling up to the function like a stretched out Steve Ballmer
View GitHub Profile
@sneakyness
sneakyness / togglePDFDarkMode.js
Created May 24, 2020 09:04
Chrome/Brave PDF Viewer Dark Mode Toggle
// When using in-browser PDF viewer, you can inspect it and run this in the console
// It's using CSS Blending to invert the colors of the PDF
function togglePDFDarkMode() {
var cover = document.createElement("div");
let inversion = `
position: fixed;
pointer-events: none;
top: 0;
left: 0;
width: 100vw;
Slayer's Testament I
In the first age, in the first battle, when the shadows first lengthened, one stood. Burned by the embers of Armageddon, his soul blistered by the fires of Hell and tainted beyond ascension, he chose the path of perpetual torment. In his ravenous hatred he found no peace; and with boiling blood he scoured the Umbral Plains seeking vengeance against the dark lords who had wronged him. He wore the crown of the Night Sentinels, and those that tasted the bile of his sword named him... the Doom Slayer.
Slayer's Testament II
Tempered by the fires of Hell, his iron will remained steadfast through the passage that preys upon the weak. For he alone was the Hell Walker, the Unchained Predator, who sought retribution in all quarters, dark and light, fire and ice, in the beginning and the end, and he hunted the slaves of Doom with barbarous cruelty; for he passed through the divide as none but demon had before.
@sneakyness
sneakyness / gist:4181233
Created December 1, 2012 09:12
Example of JSON returned from HUE
{
"lights": {
"1": {
"state": {
"on": true,
"bri": 254,
"hue": 0,
"sat": 211,
"xy": [
0.6251,
@sneakyness
sneakyness / UIColor+hexString.swift
Created March 9, 2020 23:57
Swift 5 UIColor+hexString - Accepts RGB/RRGGBB/RRGGBBAA
import Foundation
import UIKit
extension UIColor {
convenience init(hexString: String) {
var hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
if (hexString.hasPrefix("#")) {
hexString.removeFirst()
@sneakyness
sneakyness / streams.txt
Last active May 31, 2020 06:42
Streams
LA
https://www.youtube.com/watch?v=iFBP0zpTj-o
Portland
https://www.periscope.tv/w/1djxXQVdeyNKZ
🦄
https://www.pscp.tv/w/1RDxlQzdEpdKL
Good gifs:
@sneakyness
sneakyness / brightness.zsh
Created May 9, 2020 19:17
Macbook Pro Highest/Maximum Screen Backlight Brightness (Fast!) via Terminal command
# on my MBP, this sets the screen backlight brightness to max much faster than any of the other working methods I've found
# nobody seems to demonstrate that you can send a stream of events when they show how this can be used
# might be 145 or similar on your hardware, try one at a time first:
# osascript -e 'tell application \"System Events\"' -e 'key code 144' -e ' end tell'
alias bri="osascript -e 'tell application \"System Events\"' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -e 'key code 144' -
@sneakyness
sneakyness / updateSafeAreaForKeyboardFromNotification.swift
Created March 10, 2020 02:56 — forked from douglashill/updateSafeAreaForKeyboardFromNotification.swift
Avoid the keyboard by leveraging additionalSafeAreaInsets.
// Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets.
// You can put this in the root view controller so the whole app will avoid the keyboard.
// Only tested on iOS 13.3.
// Made for https://douglashill.co/reading-app/
@objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) {
guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
return
}
// Please consider whether the force unwrap here is safe for your own use case.
@sneakyness
sneakyness / Iconizer.sh
Last active February 22, 2020 00:23 — forked from richellis/Iconizer.sh
Create iOS application icons from one PDF file. Requires ImageMagick & GhostScript
#!/bin/zsh
#
#
# Iconizer shell script by Steve Richey (srichey@floatlearning.com)
# Modified by Rich Ellis (rich@richellis.net) based on contributions on Github from crishoj, giria
# Further modified by Nick Pannuto (sneakyness@sneakyness.com) based on gist comments from previous forks
# https://gist.github.com/steverichey/8493f3bd31ae71a9c933/forks
#
# Changelog:
@sneakyness
sneakyness / MyPlayground.swift
Created November 14, 2018 05:18
Generate a statuslabel.png tinted the color of your MacOS Accent Color and save it in ~/Documents/Shared Playground/Directory/
//: A Cocoa based Playground to present user interface
import AppKit
import PlaygroundSupport
import Foundation
import CoreImage
import ImageIO
let nibFile = NSNib.Name("MyView")
var topLevelObjects : NSArray?
@sneakyness
sneakyness / QuakeModels.swift
Last active July 6, 2019 20:02
Used http://app.quicktype.io to generate Swift Models for stats.quake.com API. All 3 routes (Leaderboards/Player Stats/Match History) work and serialize into codable model objects. Quad Thanks to Sponge for being very helpful and prompt with the questions I had while piecing this together. Twitter thread of progress here: https://twitter.com/Sne…
import Foundation
enum ChampionString: String, Codable {
case ranger = "RANGER"
case scalebearer = "SCALEBEARER"
case visor = "VISOR"
case anarki = "ANARKI"
case nyx = "NYX"
case sorlag = "SORLAG"
case clutch = "CLUTCH"