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
use AppleScript version "2.4" -- Yosemite (10.10) or later | |
use scripting additions | |
set document_name to "Safari Links" | |
set row_topic to "Links" | |
set browser_url to missing value | |
tell application "Safari" | |
set browser_url to URL of first document |
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/env bash | |
if [ $# != 2 ]; then | |
echo `basename $0`" <src file> <dst file>" | |
exit | |
fi | |
xattr -w "com.apple.metadata:kMDItemLatitude" $(mdls -name kMDItemLatitude "$1" | awk '{print $3}' | sed s/\"//g) "$2" | |
xattr -w "com.apple.metadata:kMDItemLongitude" $(mdls -name kMDItemLongitude "$1" | awk '{print $3}' | sed s/\"//g) "$2" |
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/env bash | |
if [ $# != 2 ]; then | |
echo `basename $0`" <src file> <dst file>" | |
exit | |
fi | |
SetFile -d '$(GetFileInfo -m "$1")' "$2" |
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
use AppleScript version "2.4" -- Yosemite (10.10) or later | |
use scripting additions | |
set content to missing value | |
tell application "Safari" | |
try | |
set content to text of first document | |
end try | |
end tell |
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
protocol ServiceLocatorType { | |
func getService<T>(type: T.Type) -> T | |
} | |
public final class ServiceLocator: ServiceLocatorType { | |
public static let instance = ServiceLocator() | |
private var serviceRegistry: [String:Any] = [:] |
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 Foundation | |
struct Platform { | |
/// Check if the current platform is the simulator. | |
/// | |
/// - Returns: true if the current platform is the simulator | |
static let isSimulator: Bool = { | |
var isSim = false | |
#if arch(i386) || arch(x86_64) | |
isSim = true |
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
extension CGFloat { | |
var radians: CGFloat { | |
let degree = Double(self) | |
return CGFloat(degree * M_PI / 180.0) | |
} | |
} |
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
set serversList to {} | |
set serverGroups to {"MyGroup1", "MyGroup2", "MyGroup3"} | |
set alertTitle to "Open AWS Servers with SSH" | |
on openServers(servers) | |
set csshx to "/usr/local/bin/csshX -y 4 --slave_settings_set CSSHX --ssh_args \"-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null\" " | |
set saveTID to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to {" "} | |
set command to (csshx & servers as text) & " &" | |
get do shell script command |
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
set aws to missing value | |
tell application "Safari" | |
tell current tab | |
set aws to do JavaScript "document.getElementsByClassName(\"AOB\")[0].textContent.match(/DNS: (.*\\.amazonaws\\.com)/)[1]" | |
end tell | |
end tell | |
if aws is not missing value then | |
tell application "Terminal" |
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/env swift | |
import Foundation | |
let args = Process.arguments | |
if (args.count != 2) { | |
print("usage: \(args[0].lastPathComponent) <file>\n") | |
exit(-1) | |
} |
NewerOlder