Skip to content

Instantly share code, notes, and snippets.

View rjyo's full-sized avatar
😁

Rakuraku Jyo rjyo

😁
  • Japan
View GitHub Profile
@rjyo
rjyo / slideshare.js
Created April 13, 2013 15:17
node.js version to download slide from slideshare.net.
var fs = require('fs'),
request = require('request'),
sys = require('sys'),
exec = require('child_process').exec;
var url = 'http://image.slidesharecdn.com/leanstartupmetricsandanalytics-120929084139-phpapp01/95/';
var tmpPath = './slides/';
var pages = 115;
var workers = 10;
var count = 0;
@rjyo
rjyo / gist:4350338
Created December 21, 2012 02:46
Check app store update with SVHTTPClient.
SVHTTPClient *client = [SVHTTPClient sharedClientWithIdentifier:@"APPSTORE"];
client.basePath = @"http://itunes.apple.com";
[client GET:[NSString stringWithFormat:@"/lookup?id=%d", APP_STORE_ID] parameters:nil completion:^(id response, NSHTTPURLResponse *urlResponse, NSError *error) {
NSDictionary *result = [response objectFromJSONDataWithParseOptions:JKParseOptionStrict];
if (result) {
NSString *latestVersion = [[result valueForKeyPath:@"results.version"] objectAtIndex:0];
NSString *appStoreURL = [[result valueForKeyPath:@"results.trackViewUrl"] objectAtIndex:0];
NSString *appName = [[result valueForKeyPath:@"results.trackName"] objectAtIndex:0];
NSString *applicationVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
@rjyo
rjyo / build.py
Created November 27, 2012 04:22
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import shutil
import json
import getopt
import urllib2
from urllib import urlencode
@rjyo
rjyo / app.js
Created October 28, 2012 14:53
get unique emails
var _ = require('underscore')
, redis = require('redis')
, fs = require('fs')
, client = redis.createClient();
var content = fs.readFileSync('./bounces', 'utf-8');
content = JSON.parse(content);
_.each(content.items, function(item) {
client.sadd('mail.del', item.address);
@rjyo
rjyo / rename.js
Created September 7, 2012 12:07
read from a text file and remove all duplicated rows
var fs = require('fs');
function readLines(input, func) {
var remaining = '';
input.on('data', function(data) {
remaining += data;
var index = remaining.indexOf('\n');
while (index > -1) {
var line = remaining.substring(0, index);
Setup
=====
[stunnel acccept port 443 connect 8443]
||
[haproxy
* accept port 80
default: connect 8080 (nginx)
host: 'push.*' => connect 8090 (node)
* accept port 8443