Skip to content

Instantly share code, notes, and snippets.

Rodrigo Lima rodrigo-lima

Block or report user

Report or block rodrigo-lima

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rodrigo-lima
rodrigo-lima / anyconnect.scpt
Last active Aug 19, 2016 — forked from halocaridina/anyconnect.scpt
update to allow VPN to be restarted and to email the new IP
View anyconnect.scpt
-- 1. Create a new generic password entry in Keychain Access called "WHATEVER_AnyConnect_VPN" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server.
-- 2. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name.
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility.
-- 4. Enable the above .app so it can access Accessibility
-- 5. Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one)
-- 6. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock
-- 7. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text
-- 8. Run script again to close connection
-- Some Constants - change as needed
View debug JS swift.md

Using WKWebView

###JSHelper.swift

/// ---------------------------------------------------------------------------
// MARK:- JSScript

struct JSScript {
    var scriptName:String
@rodrigo-lima
rodrigo-lima / gist:2631940
Created May 8, 2012
NSURLConnection + Basic Auth
View gist:2631940
@implementation WhateverClass
+ (NSString *)getBasicAuth
{
NSData *encodeData = [[NSString stringWithFormat:@"%@:%@", username, password]
dataUsingEncoding:NSUTF8StringEncoding];
// from NSData+Base64.m by Matt Gallagher
NSString *credentials = [encodeData base64EncodedString];
You can’t perform that action at this time.