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
///////////////////////////////////////////////////////// | |
// Copied from http://www.alecjacobson.com/weblog/?p=3816 | |
///////////////////////////////////////////////////////// | |
#import <Foundation/Foundation.h> | |
#import <Cocoa/Cocoa.h> | |
#import <unistd.h> | |
BOOL copy_to_clipboard(NSString *path) | |
{ | |
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage | |
NSImage * image; |
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
tell application "Safari" | |
set theWindows to the windows | |
set theURLs to {} | |
repeat with theWindow in theWindow | |
set theTabs to the tabs of theWindow | |
repeat with theTab in theTabs | |
copy the URL of theTab to the end of theURLs | |
end repeat | |
end repeat | |
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
func memoize<T: Hashable,U>(function: @escaping (T) -> U) -> (T) -> U{ | |
var cache : [T:U] = [:] | |
func memoWrapper(input: T) -> U { | |
if let cacheValue = cache[input] { | |
print("used cached result") | |
return cacheValue | |
} | |
let newVal = function(input) | |
cache[input] = newVal | |
print("new result") |
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
""" | |
Contains some faster coordinate transformations than the ones currently used in astropy. | |
This is based on an idea put forward by @bwinkel in the pull request located at | |
at https://github.com/astropy/astropy/pull/6068. This may be merged into the astropy | |
master at some point. If this happens, this module can be removed. | |
Simply import into code to experience the speedups; the astropy coordinate transforms are | |
overwritten on modeul import. | |
""" |
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 numpy as np | |
import fftw3 | |
import pyfftw | |
import multiprocessing | |
import matplotlib | |
import matplotlib.pyplot as pl | |
import time | |
def fft_comparison_tests(size=2048, dtype=np.complex128, byte_align=False): |
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
on run | |
set imessage_id to "" -- leave blank to skip sending periodic iMessage progress updates, put your iMessage ID here to get updates as the script runs | |
set delay_seconds to 5 -- Don't set to 0, it runs too fast. 0.75 is a good setting for "go fast". | |
set computer_name to do shell script "scutil --get ComputerName" | |
set os_version to do shell script "sw_vers -productVersion" | |
set os_build to do shell script "sw_vers -buildVersion" | |
set _uptime to do shell script "uptime" | |
set url_list to {"http://techmeme.com", "http://www.consumerreports.org/laptops/macbook-pros-fail-to-earn-consumer-reports-recommendation/", "https://twitter.com/panzer/status/812367550734401536", "http://www.politico.com/story/2016/12/foreign-travelers-social-media-232930", "http://www.macworld.com/article/3153384/gaming/nintendo-plans-to-release-2-or-3-mobile-games-a-year-after-super-mario-runs-success.html", "http://www.wsj.com/articles/cyber-experts-cite-link-between-dnc-hacks-and-aggression-against-uk |
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
// AFNetworking | |
[[AFHTTPSessionManager manager] GET:@"http://httpbin.org/ip" parameters:nil success:^(NSURLSessionDataTask *task, id JSON) { | |
NSLog(@"IP Address: %@", JSON[@"origin"]); | |
} failure:^(NSURLSessionDataTask *task, NSError *error) { | |
NSLog(@"Error: %@", error); | |
}]; | |
// NSURLSession | |
NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/ip"]; |
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
--Script for setting Reminders for LaunchBar and Alfred | |
--For Alfred, Applescript must NOT be set to run in Background otherwise date parsing does not work | |
--For LaunchBar, place the script in ~/Library/Scripts/LaunchBar | |
--by Michelle L. Gill, 10/07/2012 | |
--Inspired by https://gist.github.com/3187630 | |
--A related Alfred version 2 workflow can be found here: https://github.com/mlgill/alfred-workflow-create-reminder | |
--Changes | |
--02/01/2013 * Fixed an issue with setting the time when the hour is 12 and AM/PM (12-hour clock) is used | |
-- * Removed the ability to set seconds for the time since Reminders doesn't recognize them |
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
-- PurpleAir station ID | |
set theStationID to "6732" | |
tell application "JSON Helper" | |
set theWeather to (fetch JSON from ("https://www.purpleair.com/json?show=" & theStationID) with cleaning feed) | |
set theStatsA to (read JSON from (Stats of item 1 of results of theWeather)) | |
set theStatsB to (read JSON from (Stats of item 2 of results of theWeather)) | |
set theLocation to Label of item 1 of results of theWeather | |
set theLat to (Lat of item 1 of results of theWeather) | |
set theLon to (Lon of item 1 of results of theWeather) |
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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: pink; icon-glyph: user; | |
// In order to use the script, you must create a Slack app and install it on your workspace. Go here to create your app: api.slack.com/apps | |
// There's two important configurations you must make to the app: | |
// 1. Add the users.profile:write scope to the app. This scope is necessary to set a Slack status. | |
// 2. Add the following redirect URL, so Slack will redirect to Scriptable after authorizing. | |
// https://open.scriptable.app | |
// Run the script to grant your newly created app authorization to access your Slack account. After you've done this, you can use the script in Shortcuts. |