Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

sysadminctl is a tool Apple introduced in 10.10 for working with system user accounts. In 10.13,
sysadminctl is Apple's recommended tool for working with user accounts in the CLI, replacing functionality
that has long been provided by dscl and adds new features available only in 10.13.
sysadminctl can be used to change user passwords, create new users (including automatically provisioning
the user home folder) or check the status of a new-to-10.13 security feature named SecureToken.
SecureToken is a user attribute like password type or user home location. SecureToken is not publicly
documented by Apple so it is not possible to provide a full technical description, but in practice one
needs only to know if a user has SecureToken or not. Having SecureToken set signifies that a user can
unlock a FileVault-encrypted volume. Without the SecureToken bit on a user account, that user will not
@ozancaglayan
ozancaglayan / slurm_aliases.rc
Last active April 23, 2024 12:43
Aliases for SLURM
###############
# SINFO aliases
###############
# Detailed sinfo
alias si="sinfo -o '%8P %10n %.11T %.4c %.8z %.6m %12G %10l %10L %10O %20E' -S '-P'"
# sinfo only on GPU partition
alias sig="si -p gpu"
# sinfo only on CPU partition
alias sic="si -p cpu"
### Updated to reflect changes introduced with 10.13.4. Update to 10.13.4 if needed before attempting to make
SecureToken-related changes. ###
sysadminctl is a tool Apple introduced in 10.10 for working with system user accounts. In 10.13, sysadminctl is Apple's
recommended tool for working with user accounts in the CLI, replacing functionality that has long been provided by dscl
and adds new features available only in 10.13. sysadminctl can be used to change user passwords, create new users or
check the status of a new-to-10.13 security feature named SecureToken.
SecureToken is a non-visible APFS file system attribute, unlike the SIP protected flag or file creation date, that triggers
the creation of a new AuthenticationAuthority entry in a user's local account record
@jamieweavis
jamieweavis / macos-app-icon.md
Last active April 23, 2024 12:38
How to create an .icns macOS app icon
@xhit
xhit / parseduration.go
Created August 8, 2020 05:59
Golang ParseDuration with days and weeks
package main
import (
"errors"
"fmt"
"time"
)
func main() {
dur, _ := ParseDuration("1.000000001s")
var huginn = window.location.protocol + "//" + window.location.host
var auth_key = document.getElementsByName("csrf-token")[0].content;
for (var a in window.agentPaths) {
var url = huginn + window.agentPaths[a].match(/\/agents\/\d+/)[0] + "/remove_events"
console.log(url)
$.post(url,"_method=delete&authenticity_token=" + auth_key,function(data,success,xhr){
console.log("finish",url)
})
}
@shigenobuokamoto
shigenobuokamoto / network-mirrored.service
Last active April 23, 2024 12:35
/etc/systemd/system/network-mirrored.service
[Unit]
Wants=network-pre.target
Before=network-pre.target shutdown.target
[Service]
User=root
ExecStart=/bin/sh -ec '\
[ -x /usr/bin/wslinfo ] && [ "$(/usr/bin/wslinfo --networking-mode)" = "mirrored" ] || exit 0;\
echo "\
add chain ip nat WSLPREROUTING { type nat hook prerouting priority dstnat - 1; policy accept; };\
@drewkerr
drewkerr / get-focus-mode.js
Last active April 23, 2024 12:34
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
@nathan-osman
nathan-osman / build-qt5
Last active April 23, 2024 12:33
This script provides an easy way to build Qt5 for both 32 and 64-bit Windows. This script assumes that the Mingw-w64 compilers are installed on the host as well as Perl.
#!/bin/bash
#===========================================
# Download URLs for the required libraries.
#===========================================
# NOTE: if you add a URL here, you also need to add it to the
# $packages_to_build list to ensure the proper order.
declare -A urls=(
@guwidoe
guwidoe / GetLocalOneDrivePath.bas.vb
Last active April 23, 2024 12:33
VBA Function to get the local path of a OneDrive/SharePoint synchronized Microsoft Office file
'Attribute VB_Name = "GetLocalOneDrivePath"
'
' Cross-platform VBA Function to get the local path of OneDrive/SharePoint
' synchronized Microsoft Office files (Works on Windows and on macOS)
'
' Author: Guido Witt-Dörring
' Created: 2022/07/01
' Updated: 2024/04/23
' License: MIT
'