Skip to content

Instantly share code, notes, and snippets.

Hiroki Yagita yagihiro

Block or report user

Report or block yagihiro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yagihiro
yagihiro / gist:31f55f08200de13377f1d66f4c9be8e1
Created Mar 19, 2018
Create ramdisk on mac os high sierra
View gist:31f55f08200de13377f1d66f4c9be8e1
~ hiroki.yagita(HirokinoMacBook-Pro) ✅
% hdiutil attach -nomount ram://2097152                                                                                                                                                                                                                       3 19 月 14:01 JST
/dev/disk2
~ hiroki.yagita(HirokinoMacBook-Pro) ✅
% diskutil partitionDisk /dev/disk2 1 apfs test 1G                                                                                                                                                                                                            3 19 月 14:02 JST
Started partitioning on disk2
Unmounting disk
Creating the partition map
Waiting for partitions to activate
@yagihiro
yagihiro / main.go
Created Mar 12, 2018
Minimal gin application
View main.go
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
@yagihiro
yagihiro / WKNavigationDelegate+Rx.swift
Created Apr 29, 2016
WKNavigationDelegate+Rx.swift
View WKNavigationDelegate+Rx.swift
import Foundation
import RxSwift
import RxCocoa
import WebKit
class WKNavigationDelegateProxy: DelegateProxy, WKNavigationDelegate, DelegateProxyType {
static func currentDelegateFor(object: AnyObject) -> AnyObject? {
let webView: WKWebView = object as! WKWebView
return webView.navigationDelegate
@yagihiro
yagihiro / instagram_oauth_token_request_sample.php
Created Jan 25, 2016
instagram_oauth_token_request_sample.php
View instagram_oauth_token_request_sample.php
use GuzzleHttp\Client as Guzzle;
// ...
if ($request->has('code')) {
$params = $request->all();
$g = new Guzzle;
$postParams = [
'form_params' => [
@yagihiro
yagihiro / reschedulable_sidekiq.rb
Created Jan 19, 2016
Sidekiq を re-schedulable にするスニペット
View reschedulable_sidekiq.rb
# 最初にスケジュール済みのジョブを削除する
Sidekiq::ScheduledSet.new.each do |e|
if e.item[‘wrapped’] == self.class.to_s
e.delete
end
end
# もろもろ処理
# 最後に reschedule する
@yagihiro
yagihiro / simple_concurrent_queue.h
Last active Dec 2, 2015
A queue implementation with concurrency for C++11
View simple_concurrent_queue.h
/*
The MIT License (MIT)
Copyright (c) 2015 Hiroki Yagita
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
View .gitconfig
[user]
name = Hiroki Yagita
email = yagihiro@gmail.com
[color]
ui = auto
[alias]
a = add
b = branch -a
bs = branch --sort=-authordate
co = checkout
@yagihiro
yagihiro / HttpConnectionWrapper.h
Created Apr 10, 2011
Objective-C で簡単に HTTP 通信を取り扱うことができるようにするクラス
View HttpConnectionWrapper.h
//
// HttpConnectionWrapper.h
//
// Created by Hiroki Yagita on 11/04/09.
// Copyright 2011 Hiroki Yagita. All rights reserved.
//
/*! @file */
#import <Foundation/Foundation.h>
@yagihiro
yagihiro / indent.rb
Created Mar 1, 2011
簡易インデントツール (space 4つを tab 1つへ)
View indent.rb
#!/usr/bin/ruby
#
# indent.rb PATH
# -> PATH.new というインデント済みのファイルが生成されます。
#
require "stringio"
out = StringIO.new
File.foreach(ARGV[0]) do |line|
@yagihiro
yagihiro / sample.c
Last active Sep 9, 2016
mmap(2) / read(2) system call sample
View sample.c
#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
const char *files[] = {
"/usr/share/dict/american-english",
You can’t perform that action at this time.