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
| String filepath = this.getFilesDir().getAbsolutePath() + "/" + "test.txt"; | |
| File file = new File(filepath); | |
| boolean isExists = file.exists(); | |
| File file = this.getFileStreamPath("test.txt"); | |
| boolean isExists = file.exists(); |
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
| require 'rest_client' | |
| users = <<-eos | |
| 627,Spoldoccuple,[email protected],91.214.17.6 | |
| 628,pleltexpepems,[email protected],95.26.107.123 | |
| 715,sobycvdcngds,[email protected],74.121.190.76 | |
| eos | |
| result = Hash.new | |
| SLEEP_TIME = 1.0 / 24.0 |
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
| require 'rubygems' | |
| require 'mechanize' | |
| def read_page page | |
| pics = page.search("article.post > .post-content > .post-img > a"); | |
| pics.each do |d| | |
| p "#{d['href']}, #{d.children[1]['src']}" | |
| #puts d.inspect | |
| end | |
| end |
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
| //@author http://stackoverflow.com/questions/5712527/how-to-detect-total-available-free-disk-space-on-the-iphone-ipad-device | |
| - (uint64_t)freeDiskspace | |
| { | |
| uint64_t totalSpace = 0; | |
| uint64_t totalFreeSpace = 0; | |
| __autoreleasing NSError *error = nil; | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
| NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error]; |
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
| NSString * resourcePath = [[NSBundle mainBundle] resourcePath]; | |
| NSString * documentsPath = [resourcePath stringByAppendingPathComponent:@"Documents"]; | |
| NSLog(@"pngs in my dir: %@", [mainBundle pathsForResourcesOfType:@".png" inDirectory:@"projects pictures"]); | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
| NSString *documentsDirectory = [paths objectAtIndex:0]; | |
| NSError * error; | |
| NSArray * directoryContents = [[[NSArray alloc] init]autorelease]; |
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
| if ([toolbar respondsToSelector:@selector(setBackgroundImage:forToolbarPosition:barMetrics:)]) { | |
| [toolbar setBackgroundImage:[UIImage imageNamed:@"toolbar-background"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault]; | |
| } else { | |
| [toolbar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"toolbar-background"]] autorelease] atIndex:0]; | |
| } |
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
| find . -name .svn -print0 | xargs -0 rm -rf | |
| find . -name .svn -exec 'rm -rf {}\;' |
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
| gitolite trigger POST_COMPILE | |
| Most common issue: | |
| * key is corrupted and the process of updating authorized_keys file hung up |
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
| #!/bin/sh | |
| ssh -p 24 -C -f -L 5900:localhost:5900 [email protected] \ | |
| x11vnc -safer -localhost -nopw -once -display :0 \ | |
| && sleep 5 \ | |
| && vncviewer localhost:0 |