This file contains hidden or 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 | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
echo "Warning: you are about to create a hidden admin user!" | |
read -p "New admin user ID: " user_id |
This file contains hidden or 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
extension Encodable { | |
// This lets any encodable encode itself into a container. | |
fileprivate func encode(to container: inout SingleValueEncodingContainer) throws { | |
try container.encode(self) | |
} | |
} | |
// This wraps an encodable so it can be encoded. It uses the above extension so that the | |
// we don't have to know the encodable's type. | |
struct AnyEncodable : Encodable { |
This file contains hidden or 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
/// Property wrapper that acts the same as @AppStorage, but also provides a ``Publisher`` so that non-View types | |
/// can receive value updates. | |
@propertyWrapper | |
struct PublishingAppStorage<Value> { | |
var wrappedValue: Value { | |
get { storage.wrappedValue } | |
set { | |
storage.wrappedValue = newValue | |
subject.send(storage.wrappedValue) |