Skip to content

Instantly share code, notes, and snippets.

View 4np's full-sized avatar

Jeroen Wesbeek 4np

  • ServiceNow
  • The Netherlands
View GitHub Profile
@4np
4np / touch-id-to-sudo.md
Created November 4, 2024 08:28
Use Touch ID or Apple Watch to sudo or authorize other Administrator tasks.

sudo using Touch ID or Apple Watch double press

It is possible to enable Touch ID to authorize sudo and other administrative tasks. If you have linked an Apple Watch you'll also be able to double press the Apple watch side button to approve.

You need to do the following in terminal:

cd /etc/pam.d/
sudo cp sudo_local.template sudo_local
@4np
4np / LocalizedTests.swift
Created August 1, 2024 16:15
Run tests using a particular locale and / or language (useful for SPM projects)
import XCTest
class SomeTests: XCTestCase {
override class func setUp() {
super.setUp()
UserDefaults.standard.set("en_US", forKey: "AppleLocale")
UserDefaults.standard.set(["en_US"], forKey: "AppleLanguages")
UserDefaults.standard.synchronize()
}
@4np
4np / WireGuard iOS HOWTO.md
Last active June 22, 2024 03:44
Setting up WireGuard to secure iPhone traffic

WireGuard

How to set up WireGuard as an iOS VPN configuration in order to tunnel all traffic from an iOS or iPadOS device through a Linux server.

While there are many configurations possible, my intentation was to secure the traffic from my iOS device by routing it securely through a Linux server. As such, this HowTo will show you how to set-up an initial working configuration, which you can customize afterward.

Most likely things will be missing, such as how to configure the firewall or the init scripts on your Linux distribution. As it won't be possible to cover all Linux flavors this HowTo will attempt to give you a working WireGuard configuration, leaving it up to you to fill-in the blanks. Feel free to write a comment to touch upon your specific situation to help others that might stumble upon this HowTo :)

Note: In these configuration examples I use 10.8.0.1/24 and 10.8.0.2/24. However, as WireGuard IPs may not overlap your other network interfaces

@4np
4np / Podfile
Created July 28, 2022 09:54
Podfile with customized Xcode sandbox sync messages if the sandbox is not in sync with Podfile.lock
source 'https://cdn.cocoapods.org/'
platform :ios, '15.0'
inhibit_all_warnings!
use_frameworks!
target 'MyApp' do
pod 'SomePod', '~> 1.0'
end
@4np
4np / Netherlands-Corona-Check-Info.sh
Last active July 28, 2022 09:56
Netherlands Corona Check Info
# Configuration
curl -s https://verifier-api.coronacheck.nl/v4/verifier/config | jq -r .payload | base64 -d | jq .
# Public keys
curl -s https://verifier-api.coronacheck.nl/v4/verifier/public_keys | jq -r .payload | base64 -d | jq .
@4np
4np / remove-ios-simulators.sh
Created December 9, 2021 11:16
Remove all installed iOS Simulators
rm -rf ~/Library/*/CoreSimulator
@4np
4np / macOS-beta-enrollment.md
Last active November 23, 2020 13:16
Fix macOS beta opt out / unenrollment

Sometimes unenrolling from the macOS beta feed does not work properly.

macOS Beta Channel

You can fix this by enrolling / unenrolling through Terminal:

sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil enroll DeveloperSeed
sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil unenroll
@4np
4np / RetainCyclePlayground.swift
Last active May 15, 2020 08:21
A Swift Playground demonstrating why you need to again weekly capture self in nested closures after unwrapping self.
import Cocoa
class TestClass {
var name = ""
var block1: (() -> Void)?
var block2: (() -> Void)?
var retainCount: Int {
CFGetRetainCount(self)
}
@4np
4np / ValueTypePlayground.swift
Created May 15, 2020 07:48
Swift value type memory management
import Cocoa
func address(of object: UnsafeRawPointer) -> String {
let addr = Int(bitPattern: object)
return String(format: "%p", addr)
}
struct Foo {
public var baz: String
}
@4np
4np / named.conf
Created October 15, 2019 20:42 — forked from cpswan/named.conf
Unbound/BIND config for DNS over TLS to 1.1.1.1
options {
directory "/tmp";
listen-on-v6 { none; };
forwarders {
127.0.0.1 port 2053;
};
auth-nxdomain no; # conform to RFC1035