Skip to content

Instantly share code, notes, and snippets.

View slowbrewedmacchiato's full-sized avatar

sbm slowbrewedmacchiato

View GitHub Profile
square.and.arrow.up
square.and.arrow.up.fill
square.and.arrow.up.circle
square.and.arrow.up.circle.fill
square.and.arrow.up.badge.clock
square.and.arrow.up.badge.clock.fill
square.and.arrow.up.trianglebadge.exclamationmark
square.and.arrow.up.trianglebadge.exclamationmark.fill
square.and.arrow.down
square.and.arrow.down.fill
import Foundation
// MARK: - Library
public extension UserDefaults {
struct Key<Value> {
let key: String
public init(key: String) {
self.key = key
@jsharp83
jsharp83 / CameraManager.swift
Last active June 11, 2025 02:28
Basic camera code using AVCaptureSession in iOS
import Foundation
import AVFoundation
@objc
protocol CameraCaptureDelegate: class {
func captureVideoOutput(sampleBuffer: CMSampleBuffer)
@objc optional func captureAudioOutput(sampleBuffer: CMSampleBuffer)
}
class CameraManager: NSObject {
@wavezhang
wavezhang / java_download.sh
Last active July 10, 2025 04:03
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@habovh
habovh / crashdialog
Last active September 17, 2024 23:16
Simple bash script to quickly enable/disable macOS crash reporting dialogs. Tested on macOS Sierra.
#!/bin/bash
# Author: Jordan Becker (https://becker.io/)
if [ $# -lt 1 ]; then
echo "Usage: $0 (on|off|read)"
echo "Lets you quickly enable or disable macOS crash reporting dialogs. Useful for betas ;)"
exit 1
fi
case "$1" in
@mluton
mluton / CachedDateFormatter.swift
Last active August 8, 2023 12:04
Swift class that instantiates and caches NSDateFormatter objects
class CachedDateFormatter {
static let sharedInstance = CachedDateFormatter()
var cachedDateFormatters = [String: NSDateFormatter]()
func formatterWith(#format: String, timeZone: NSTimeZone = NSTimeZone.localTimeZone(), locale: NSLocale = NSLocale(localeIdentifier: "en_US")) -> NSDateFormatter {
let key = "\(format.hashValue)\(timeZone.hashValue)\(locale.hashValue)"
if let cachedDateFormatter = cachedDateFormatters[key] {
return cachedDateFormatter
}
@haf
haf / LICENSE
Last active February 14, 2024 11:15
Setting up a digitalocean proxy
https://www.gnu.org/licenses/gpl-3.0.en.html
GNU GENERAL PUBLIC LICENSE v3
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active June 12, 2025 15:08
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 11, 2025 18:12
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@rakhmad
rakhmad / clojure.md
Created April 17, 2012 15:55
Setting Up Clojure on OS X

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

Step 1: Getting Clojure (1.3)