Skip to content

Instantly share code, notes, and snippets.

View minase's full-sized avatar
🐈
i love cat.

oda minase

🐈
i love cat.
View GitHub Profile
# 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}"
@minase
minase / ProlificUsbSerial.kext-Info.plist.diff
Created February 13, 2013 12:08
Prolific PL2303 Driver v1.4.0 + USB-RSAQ5
*** 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>
#!/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 ===="
@minase
minase / gist:640025
Created October 22, 2010 05:49
vmstatics.c
// 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
//
// ImagePicker で選択された画像を保存する
//
//
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];
// 画像を保存(バンドルのルートディレクトリ)
NSData *jpeg = [[NSData alloc] initWithData:UIImageJPEGRepresentation(image, 100)];
#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;
@minase
minase / gist:229419
Created November 8, 2009 18:37
XPathEvaluator.m
#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
## % ruby -rnet/http twitpost.rb
res = Net::HTTP.post_form(URI.parse("http://USERNAME:PASSWORD@twitter.com/statuses/update.xml"), :status => 'おっぱい', :source => 'oppai')
puts 'update was failed' unless res.instance_of? Net::HTTPOK
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'
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'