Skip to content

Instantly share code, notes, and snippets.

View foreignfilm's full-sized avatar

Arnold foreignfilm

View GitHub Profile
@foreignfilm
foreignfilm / macOS_SytemPrefs.md
Created February 29, 2024 07:24 — forked from rmcdongit/macOS_SytemPrefs.md
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@foreignfilm
foreignfilm / String+ContainsEmoji.swift
Last active March 2, 2018 13:06 — forked from Ziewvater/gist:998b5806b0d12e4cf35b
Determining if a Swift string contains emoji characters (or other dingbats)
extension String {
var containsEmoji: Bool {
for scalar in unicodeScalars {
switch scalar.value {
case 0x1F600...0x1F64F, // Emoticons
0x1F300...0x1F5FF, // Misc Symbols and Pictographs
0x1F680...0x1F6FF, // Transport and Map
0x2600...0x26FF, // Misc symbols
0x2700...0x27BF, // Dingbats
//
// Reachability.swift
//
// The MIT License (MIT)
// Copyright © 2015 Arnold Sakhnov
//
// Super simple Swift 2.0 struct for your basic Rechability needs
// Use it like so:
//
// if (Rechability.isCurrentlyConnected) { ... }
@foreignfilm
foreignfilm / apache_mac_aliases.sh
Created April 18, 2013 10:50
Some handy bash aliases for controlling Apache on Mac. Tested on OS X 10.8.3. Add the below code to your ~/.bash_profile and run `source ~/.bash_profile`. Install terminal-notifier (`sudo gem install terminal-notifier`) for Notification Center alerts.
alias apache-start="sudo apachectl start"
alias apache-stop="sudo apachectl stop"
alias apache-restart="sudo apachectl restart"
alias apache-config="subl /etc/apache2/httpd.conf /etc/apache2/extra/httpd-vhosts.conf /etc/hosts -n"
apache-toggle-vhost() {
apache_httpd_conf_file="/etc/apache2/httpd.conf"
commented_out=$(sudo perl -pi -e 'END { print($prefix)} s/(#?)Include (.*?-vhosts.conf$)/if($1){$prefix=""}else{$prefix="#"}$prefix."Include ".$2/e' $apache_httpd_conf_file)
if [ -n "$commented_out" ]; then
terminal-notifier -message "Virtual Hosts are disabled. Apache restarted" -title "Virtual Hosts Off"
@foreignfilm
foreignfilm / hack.sh
Created March 31, 2012 13:14 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#