Skip to content

Instantly share code, notes, and snippets.

View sonsongithub's full-sized avatar

Yuichi Yoshida sonsongithub

View GitHub Profile
class PreferenceStruct
def initialize(line)
typeTable = {
"boolean"=>"Bool",
"an integer between"=>"Int",
"a valid IETF language tag"=>"String",
"subreddit name" => "String",
"one of \\(`on`, `off`, `subreddit`\\)" => "PreferenceMediaType",
"one of \\(`confidence`, `old`, `top`, `qa`, `controversial`, `new`\\)" => "PreferenceDefaultCommentSortType"
@sonsongithub
sonsongithub / gist:eee3268417ae69880162
Created November 14, 2015 08:57
octokit Issue class Properties
{
:url=>"https://api.github.com/repos/sonsongithub/reddift/issues/21",
:labels_url=>"https://api.github.com/repos/sonsongithub/reddift/issues/21/labels{/name}",
:comments_url=>"https://api.github.com/repos/sonsongithub/reddift/issues/21/comments",
:events_url=>"https://api.github.com/repos/sonsongithub/reddift/issues/21/events",
:html_url=>"https://github.com/sonsongithub/reddift/issues/21",
:id=>68853891,
:number=>21,
:title=>"/api/deleteflairtemplate",
:user=>{
@sonsongithub
sonsongithub / issue2wiki.rb
Last active November 14, 2015 08:59
octokit convert Issue list to wiki page.
require 'octokit'
client = Octokit::Client.new(:access_token => "")
user = client.user
puts user.login
page = 1
issues = []
for i in 1..20
@sonsongithub
sonsongithub / closeIssues.rb
Created November 14, 2015 08:59
octokit issue closer
require 'octokit'
client = Octokit::Client.new(:access_token => "")
user = client.user
puts user.login
page = 1
issues = []
for i in 1..20
@sonsongithub
sonsongithub / gist:7e3ee60f0732bd08e8c3c16026c18985
Created April 1, 2016 06:25
Script to generate swift source from YouTube streaming data via get_video_info API
source = <<EOS
csi_page_type
url_encoded_fmt_stream_map
enabled_engage_types
tag_for_child_directed
enablecsi
caption_tracks
ptk
account_playback_token
ad_device
@sonsongithub
sonsongithub / CodePiece.swift
Created May 7, 2016 05:16
試し #CodePiece
var cell = tableView.dequeueReusableCellWithIdentifier(contents.cellIdentifier)
@sonsongithub
sonsongithub / CodePiece.swift
Created May 7, 2016 06:15
さっきのコード #CodePiece #yidev
protocol Photo {
func getName() -> String
}
struct Facebook: Photo {
func getName() -> String {
return "facebook"
}
}
@sonsongithub
sonsongithub / post.rb
Last active May 23, 2016 16:51
Ruby script to send Firebase notification.
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('https://fcm.googleapis.com/fcm/send')
http_proxy = ENV['HTTP_PROXY']
https_proxy = ENV['HTTPS_PROXY']
proxy_host = nil
@sonsongithub
sonsongithub / uploader.m
Created May 29, 2016 19:47
To upload an image to imgur.com in Objective-C.
NSString *clientID = @"your client ID";
NSString *XMashapeKey = @"your key";
NSMutableCharacterSet *allowedCharacterSet = [NSMutableCharacterSet alphanumericCharacterSet];
[allowedCharacterSet addCharactersInString:@"-._~"];
NSString *base64 = [imageBinaryData base64EncodedStringWithOptions:0];
NSString *escapedBase64 = [base64 stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://imgur-apiv3.p.mashape.com/3/image"]];
@sonsongithub
sonsongithub / ssl_check.rb
Created June 7, 2016 16:11
SSLの証明書の期限をJSONで書き出すコード
require 'json'
require 'date'
r = []
hosts = []
hosts.each{|host|
if`sudo openssl x509 -in /etc/letsencrypt/live/#{host}/fullchain.pem -noout -dates` =~ /notAfter=(.+?)$/
entry = {}