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
$ df -h | |
Filesystem Size Used Avail Use% Mounted on | |
/dev/sda1 146G 25G 114G 18% / | |
none 242M 180K 242M 1% /dev | |
none 248M 0 248M 0% /dev/shm | |
none 248M 76K 248M 1% /var/run | |
none 248M 0 248M 0% /var/lock | |
none 146G 25G 114G 18% /var/lib/ureadahead/debugfs | |
$ sudo fdisk -l | |
ディスク /dev/sdb: 1000.2 GB, 1000204886016 バイト |
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
(setq growl-program (executable-find "growlnotify")) | |
(defun growl (title message &optional app) | |
(when growl-program | |
(unless app | |
(setq app "")) | |
(start-process "Growl" "*Growl*" growl-program | |
"-t" title | |
"-m" message | |
"-a" app))) |
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
@interface NSObject(Swizzle) | |
+ (void)swizzleMethod:(SEL)orig_sel withMethod:(SEL)alt_sel; | |
@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
#ifdef __OBJC__ | |
# import <Foundation/Foundation.h> | |
# import <UIKit/UIKit.h> | |
#endif | |
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200) | |
# define IS_PAD UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad | |
# define IS_PHONE UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad | |
#else | |
# define IS_PAD NO |
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
// Make button block. | |
UIBarButtonItem* (^buttonWithTitle)(NSString*, SEL) = ^(NSString* title, SEL action) | |
{ | |
UIBarButtonItem* button = [UIBarButtonItem alloc]; | |
[button initWithTitle:title | |
style:UIBarButtonItemStyleBordered | |
target:self | |
action:action]; | |
[button setWidth:65.0f]; | |
[button 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
// $ gcc -o hello hello.c | |
// $ ./hello | |
#include <stdio.h> | |
int main(void) | |
{ | |
printf("Hello, World!\n"); | |
return 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
DefaultHttpClient client = new DefaultHttpClient(); | |
HttpPost post = new HttpPost(url); | |
MultipartEntity entity = new MultipartEntity(); | |
entity.addPart("email", new StringBody(email)); | |
entity.addPart("password", new StringBody(password)); | |
post.setEntity(entity); | |
HttpResponse responce = client.execute(post); | |
int statusCode = responce.getStatusLine().getStatusCode(); | |
InputStream content = responce.getEntity().getContent(); |
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 <Foundation/Foundation.h> | |
@interface Account : NSObject | |
{ | |
NSString* uuid; | |
NSString* email; | |
NSString* password; | |
} | |
@property (readonly) NSString* uuid; |
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
# -*- coding: utf-8 -*- | |
#!/usr/bin/env ruby | |
require 'webrick' | |
require 'webrick/httpproxy' | |
require 'uri' | |
require 'open-uri' | |
handler = Proc.new() do |req, res| | |
if req.host == 'target.example.com' |
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.prototype.pad = function() { | |
String.PAD_LEFT = 'STRING_PAD_LEFT'; | |
String.PAD_RIGHT = 'STRING_PAD_RIGHT'; | |
var default_pad_string = ' '; | |
var default_pad_type = String.PAD_RIGHT; | |
return function (length, pad_string, pad_type) { | |
var result = this.toString(); | |
pad_string = pad_string == undefined ? default_pad_string : pad_string.toString(); | |
pad_type = pad_type || default_pad_type; | |
if (pad_type == String.PAD_LEFT) { |