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
# lib/tasks/unicorn.rake | |
namespace :unicorn do | |
config = Rails.root + 'config/unicorn.rb' | |
rackup = Rails.root + 'config.ru' | |
pid_file = Rails.root + 'tmp/pids/unicorn.pid' | |
pid = File.exist?(pid_file) ? File.read(pid_file).to_i : nil | |
desc 'Starting unicorn process' | |
task :start => :environment do | |
sh "bundle exec unicorn_rails -D -c #{config} #{rackup}" |
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
*** Info.plist.org 2010-03-25 16:47:26.000000000 +0900 | |
--- Info.plist 2013-02-13 21:01:40.000000000 +0900 | |
*************** | |
*** 41,46 **** | |
--- 41,63 ---- | |
<key>idVendor</key> | |
<integer>1659</integer> | |
</dict> | |
+ <key>04BB_0A0E</key> | |
+ <dict> |
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
#!/usr/bin/env tclsh | |
proc http_server {sock host port} { | |
set request [read_request $sock] | |
set response [mk_response] | |
# puts to stdout | |
puts "==== Request header(from: $host:$port) ====" | |
puts $request | |
puts "==== Response header and body ====" |
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
// vim: fileencoding=utf-8 expandtab tabstop=2 shiftwidth=2 : | |
// | |
// vmstatics.c | |
// | |
// % clang -Wall -o vmstatics vmstatics.c | |
// % ./vmstatics | |
// active 1627869184 | |
// inactive 1990959104 | |
// wired 1616474112 | |
// speculative 1243693056 |
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
// | |
// ImagePicker で選択された画像を保存する | |
// | |
// | |
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info | |
{ | |
UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage]; | |
// 画像を保存(バンドルのルートディレクトリ) | |
NSData *jpeg = [[NSData alloc] initWithData:UIImageJPEGRepresentation(image, 100)]; |
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 <Foundation/Foundation.h> | |
#define TAPE_MAX_WIDTH 1 | |
@interface BrainFxck : NSObject | |
{ | |
const char *code; | |
unsigned char *tape; | |
unsigned int position; | |
unsigned int tape_width; |
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 "Foundation/Foundation.h" | |
#include <libxml/HTMLparser.h> | |
#include <libxml/HTMLtree.h> | |
#include <libxml/xpath.h> | |
@interface XPathEvaluator : NSObject | |
+(NSArray*)arrayWithXPathQuery:(NSString*)query fromHTML:(NSString*)html; | |
@end | |
@implementation XPathEvaluator |
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
## % ruby -rnet/http twitpost.rb | |
res = Net::HTTP.post_form(URI.parse("http://USERNAME:[email protected]/statuses/update.xml"), :status => 'おっぱい', :source => 'oppai') | |
puts 'update was failed' unless res.instance_of? Net::HTTPOK |
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
def build_multipart_post_data(params, boundary) | |
enter = "\r\n" | |
data = '' | |
params.each do |k,v| | |
next if v.nil? | |
data << '--' + boundary + enter | |
data << %Q[Content-Disposition: form-data; name="#{k.to_s}"] | |
if k.to_s == 'file' |
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
def build_multipart_post_data(params, boundary) | |
enter = "\r\n" | |
data = '' | |
params.each do |k,v| | |
next if v.nil? | |
data << '--' + boundary + enter | |
data << %Q[Content-Disposition: form-data; name="#{k.to_s}"] | |
if k.to_s == 'file' |
NewerOlder