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
#!/bin/bash | |
cd ~/Library/Application\ Support/MobileSync/Backup | |
backup=`ls -t1 | sed -n '1p'` # most recent backup | |
for f in "$backup"/*.mdinfo; do | |
grep -q "Library/AddressBook/AddressBook.sqlitedb" $f | |
if [ $? -eq 0 ]; then | |
addressbook=`basename $f .mdinfo` | |
cp -v "`pwd`/$backup/$addressbook.mddata" ~/Library/Application\ Support/iPhone\ Simulator/User/Library/AddressBook/AddressBook.sqlitedb | |
exit $? |
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
package com.util; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.net.URL; |
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
# -*- Encoding: utf-8 -*- | |
from M2Crypto.EVP import Cipher | |
key = 'a' * 16 | |
text = 'Hello, there!' | |
cipher = Cipher(alg='des_ede_ecb', key=key, op=1, iv='\0'*16) |
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
- (void)test | |
{ | |
NSMutableDictionary *testDic = [NSMutableDictionary dictionary]; | |
[testDic setValue:@"dic value" forKey:@"1"]; | |
NSMutableArray *testArr = [NSMutableArray array]; | |
[testArr addObject:[NSNumber numberWithInt:10]]; | |
if ([testDic.allKeys containsObject:@"1"]) |
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
C YES true | |
C NO false | |
C nil null | |
C NULL null | |
: applicationDidFinishLaunching: v12@0:4@8 | |
T id @ | |
T short s |
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
property bOff : true | |
tell application "System Preferences" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
click menu item "Sharing" of menu "View" of menu bar 1 | |
tell window "Sharing" |
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 "System Preferences" | |
activate | |
reveal (pane id "com.apple.preferences.sharing") | |
end tell | |
tell application "System Events" to tell table 1 of scroll area of group 1 of window 1 of process "System Preferences" | |
tell (1st row whose value of static text 1 is "File Sharing") | |
set sharingStatus to value of checkbox 1 as boolean | |
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 eleDesString to "" | |
tell application "System Preferences" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
click menu item "Network" of menu "View" of menu bar 1 | |
click button "Advanced…" of window "Network" |
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
// Reads in a set of raw data files, and outputs smoothed files. (lots of libdispatch magic) | |
#define SIGMA (50) | |
- (IBAction)smoothDataSets:(id)sender { | |
[openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger ret){ | |
if(ret == NSOKButton){ | |
// Apply to each file and then output appropriately. | |
dispatch_group_t smooth_group = dispatch_group_create(); | |
dispatch_queue_t global_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
for(NSURL *url in [openPanel URLs]){ | |
const char *in_path = [[url path] UTF8String]; |
NewerOlder