This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "Charles Enabler" | |
// https://stackoverflow.com/a/57253011/584548 | |
public class NetworkEnabler: NSObject, URLSessionDelegate { | |
public func urlSession(_ session: URLSession, | |
didReceive challenge: URLAuthenticationChallenge, | |
completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# - Curls Heroku servers indicated in the "hosts" file. | |
# - Logs actions to log files (unique per host), including the response HTTP status | |
# - Clean up log files if > 5mb | |
# | |
# Simply add the target hosts in the "hosts" file, like: | |
# my-server-01.herokuapp.com | |
# my-server-02.herokuapp.com | |
# NOTICE: There must be a new line at the end of the "hosts" file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# register a subdomain at https://www.duckdns.org/ to get your token | |
# put 'hostname|token' in the 'Host Name' field under DDNS (custom) | |
# e.g. myhost|abcdefgh-1234-5678-9876-f71b0ed7a7fe | |
DDNS_HOSTNAME_FIELD=$(nvram get ddns_hostname_x) | |
SUBDOMAIN=$(echo "$DDNS_HOSTNAME_FIELD" | awk -F'|' '{print $1}') | |
TOKEN=$(echo "$DDNS_HOSTNAME_FIELD" | awk -F'|' '{print $2}') | |
IP="$(curl -fs4 https://myip.dnsomatic.com/)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
import Foundation | |
// TINY EXAMPLE | |
/* | |
let jsonData = Data( | |
""" | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See this wiki page for more info: | |
# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info | |
# | |
# brew install neofetch | |
# mkdir ~/.config/neofetch | |
# touch config.conf | |
# pbpaste > config.conf | |
print_info() { | |
info title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Save this as a .py file in your user package dir, e.g.: | |
# /Users/<name>/Library/Application Support/Sublime Text 3/Packages/User/u200b_killer.py | |
### | |
# Source: https://rdzhou.github.io/2017/07/31/How-to-Remove-u200b/ | |
import sublime, sublime_plugin | |
class ShowU200b(sublime_plugin.TextCommand): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://stackoverflow.com/a/24302276/584548 | |
for i in *; do name="${i%.*}"; mv "$i" "${name}👉🏻👉🏻👉🏻@1x👈🏻👈🏻👈🏻${i#$name}"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension View { | |
/// Source: https://stackoverflow.com/a/59473712/584548 | |
func log(_ vars: Any...) -> some View { | |
vars.forEach { print("\($0)") } | |
return EmptyView() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
See "Displaying Human-Friendly Content" | |
https://developer.apple.com/documentation/foundation/formatter/displaying_human-friendly_content | |
*/ | |
import Foundation | |
/*: | |
## Number Formatter | |
Provides localized representations of units and measurements. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
import Foundation | |
func shell(_ command: String) { | |
let task = Process() | |
task.launchPath = "/bin/zsh" | |
task.arguments = ["-c", command] | |
let pipe = Pipe() |
NewerOlder