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
#!/usr/bin/perl | |
# Written by Claudio Ramirez <[email protected]> | |
# A small wrapper around Solaris ifconfig to get rid of the awful | |
# hexadecimal netmask (ffffff00 => 255.255.255.0) | |
# | |
# Modified to address change in filesystem | |
use strict; | |
use warnings; |
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
import Cocoa | |
extension String { | |
func scan(regex: String) -> [String] { | |
let regex = NSRegularExpression(pattern: regex, | |
options: nil, error: nil)! | |
let nsString = self as NSString | |
let results = regex.matchesInString(self, options: NSMatchingOptions(0), range: NSMakeRange(0, (self as NSString).length)) | |
as! [NSTextCheckingResult] | |
return map(results) { nsString.substringWithRange($0.range)} |
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
tell application "Safari" | |
activate | |
open location "http://www.google.com" | |
delay 3 | |
set theScript to "document.getElementById('lst-ib').value = 'hello world'" | |
do JavaScript theScript in current tab of first window | |
end tell |
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
{% from "macros.html" import nav_link with context %} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Flask Template Example</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
div#main { | |
max-width: 500px; | |
padding: 20px; |
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
import sys | |
n = None | |
try: | |
n = int(sys.argv[1]) | |
except (ValueError, IndexError) as e: | |
pass # Ignore error here | |
if (len(sys.argv) == 1) or (n is None): |
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
rm -rf ~/Library/Preferences/com.apple.appstore.plist | |
rm -rf ~/Library/Preferences/com.apple.storeagent.plist | |
rm -rf ~/Library/Preferences/ByHost/* |
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
App = Application.currentApplication(); | |
App.includeStandardAdditions = true | |
App.say("Hello from Dan's JavaScript automation!!!"); |
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 NSFileManager { | |
func fileExists(path: String) -> (Bool, isDirectory: Bool) { | |
var dir: ObjCBool = true | |
let status = self.fileExistsAtPath(path, isDirectory: &dir) | |
return (status, dir.boolValue) | |
} | |
} | |
NSFileManager.defaultManager().fileExists("/Applications").isDirectory |
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
type file; | |
app (file o) simulate_app () | |
{ | |
simulate stdout=filename(o); | |
} | |
foreach i in [1:10] { | |
string fname=strcat("output/sim_", i, ".out"); | |
file f <single_file_mapper; file=fname>; |
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
(define (square x) | |
(* x x)) |