Skip to content

Instantly share code, notes, and snippets.

View JALsnipe's full-sized avatar
🥴

Josh Lieberman JALsnipe

🥴
View GitHub Profile
@JALsnipe
JALsnipe / swifterror.txt
Created December 5, 2016 03:39
IBM Swift Sandbox Error
Error running code:
WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.
/swiftfiles/doit.sh: line 51: 43 Illegal instruction timeout ${TIMEOUT} .build/debug/TempCode
Error response from daemon: Driver aufs failed to remove root filesystem 473d41d82ca93d3652f5a3fb3c6caa6fb7a31905a602f065d188e1fb3674b449: rename /var/lib/docker/493216.493216/aufs/diff/79bf45f40d10629a3c84d4e79b708d90334297a56ce1fd71058d5c7ac7c722bd /var/lib/docker/493216.493216/aufs/diff/79bf45f40d10629a3c84d4e79b708d90334297a56ce1fd71058d5c7ac7c722bd-removing: device or resource busy
// Write some awesome Swift code, or import libraries like "Foundation",
// "Dispatch", or "Glibc"
import Foundation
let base64EncodedInput = "ICA3NzUgIDc4NSAgMzYxDQogIDYyMiAgMzc1ICAxMjUNCiAgMjk3ICA4MzkgIDM3NQ0KICAyNDUgICAzOCAgODkxDQogIDUwMyAgNDYzICA4NDkNCiAgNzMxICA0ODIgIDc1OQ0KICAgMjkgIDczNCAgNzM0DQogIDI0NSAgNzcxICAyNjkNCiAgMjYxICAzMTUgIDkwNA0KICA2NjkgICA5NiAgNTgxDQogIDU3MCAgNzQ1ICAxNTYNCiAgMTI0ICA2NzggIDY4NA0KICA0NzIgIDM2MCAgIDczDQogIDE3NCAgMjUxICA5MjYNCiAgNDA2ICA0MDggIDk3Ng0KICA0MTMgIDIzOCAgNTcxDQogIDM3NSAgNTU0ICAgMjINCiAgMjExICAzNzkgIDU5MA0KICAyNzEgIDgyMSAgODQ3DQogIDY5NiAgMjUzICAxMTYNCiAgNTEzICA5NzIgIDk1OQ0KICA1MzkgIDU1NyAgNzUyDQogIDE2OCAgMzYyICA1NTANCiAgNjkwICAyMzYgIDI4NA0KICA0MzQgICA5MSAgODE4DQogIDg1OSAgMzkzICA3NzkNCiAgNjIwICAzMTMgICA1Ng0KICAxODggIDk4MyAgNzgzDQogIDc5OSAgOTAwICA1NzMNCiAgOTMyICAzNTkgIDU2NQ0KICAzNTcgIDY3MCAgIDY5DQogIDUyNSAgIDcxICAgNTINCiAgNjQwICA2NTQgICA0Mw0KICA2OTUgIDc4MSAgOTA3DQogIDY3NiAgNjgwICA5MzgNCiAgIDYzICA1MDcgIDU3MA0KICA5ODUgIDQ5MiAgNTg3DQogIDk4NCAgIDM0ICAzMzMNCiAgIDI1ICA0ODkgI
@JALsnipe
JALsnipe / advent2016day1.swift
Last active December 2, 2016 03:18
Advent of Code 2016 Day 1 Silver in Swift 3
import Foundation
enum Direction: String {
case right = "R"
case left = "L"
}
enum CompassPoint {
case north
case south
@JALsnipe
JALsnipe / crc32.swift
Created October 11, 2016 15:14 — forked from MaddTheSane/crc32.swift
crc32 implemented in Swift (Swift 3)
//
// crc32.swift
// SuperSFV
//
// Created by C.W. Betts on 8/23/15.
//
//
/* crc32.swift -- compute the CRC-32 of a data stream
Copyright (C) 1995-1998 Mark Adler
Copyright (C) 2015 C.W. "Madd the Sane" Betts
@JALsnipe
JALsnipe / BatteryInfo.swift
Last active November 5, 2021 13:47
Script to get iOS device battery info from the BatteryCenter private framework
import Foundation
guard case let batteryCenterHandle = dlopen("/System/Library/PrivateFrameworks/BatteryCenter.framework/BatteryCenter", RTLD_LAZY) where batteryCenterHandle != nil else {
fatalError("BatteryCenter not found")
}
guard let c = NSClassFromString("BCBatteryDeviceController") as? NSObjectProtocol else {
fatalError("BCBatteryDeviceController not found")
}
# Type(<scope>): <subject>
# <body>
# <footer>
# Type should be one of the following:
# * feat (new feature)
# * fix (bug fix)
# * docs (changes to documentation)
@JALsnipe
JALsnipe / .git-commit-template.txt
Created March 11, 2016 05:17 — forked from adeekshith/.git-commit-template.txt
A Git commit template to make it easy to enforce a good and uniform commit message style across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@JALsnipe
JALsnipe / invokeSKUIImageColorAnalyzer.swift
Created February 10, 2016 22:40
Get colors for a UIImage using the private StoreKitUI framework
// Forward declaration
class SKUIAnalyzedImageColors: NSObject {}
// convienence extensions for accessing private properties
extension SKUIAnalyzedImageColors {
func backgroundColor() -> UIColor {
return self.valueForKey("_backgroundColor") as! UIColor
}
@JALsnipe
JALsnipe / reset.rb
Last active December 7, 2015 15:28
Reset all iOS Simulators
# Reset all iOS Simulators
# Modified to reset without prompt from stdin
simulatorList = []
# Get all of the simulator UUIDs from Xcode
rawSimulatorList = `xcrun simctl list`
rawSimulatorList.each_line do |line|
if line.start_with?(" ")
simulator = line.strip
@JALsnipe
JALsnipe / importUIKit
Created April 17, 2015 16:42
Swift REPL import UIKit
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:9: note: while building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:
#import <Availability.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/cdefs.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/cdefs.h:680:2: error: Unsupported architecture
#error Unsupported architecture
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:9: note: while building