Skip to content

Instantly share code, notes, and snippets.

View gabu's full-sized avatar
Working from Sapporo

Shoya Tsukada gabu

Working from Sapporo
View GitHub Profile
@gabu
gabu / cpuminer_setup.sh
Last active December 6, 2017 16:29 — forked from paulsheldrake/cpuminer_setup.sh
Install cpuminer on an AWS instance
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install git libcurl-devel libcurl jansson-devel jansson
# install cpuminer
git clone --recursive https://github.com/pooler/cpuminer.git
cd cpuminer
git checkout v2.3.3
./autogen.sh
./configure CFLAGS="-O3"
@gabu
gabu / gist:d31ab53ebd8022e7df6d16440aee43aa
Created July 20, 2016 02:41
Rename classes for Rails 5
# app/models
git grep -l ActiveRecord::Base -- app/models | xargs sed -i '' "s/ActiveRecord::Base/ApplicationRecord/g"
# test/controllers
git grep -l ActionController::TestCase -- test/controllers | xargs sed -i '' "s/ActionController::TestCase/ActionDispatch::IntegrationTest/g"
@gabu
gabu / gist:fa671ae685413baebab9
Created August 6, 2014 12:53
CMTimeMake vs CMTimeMakeWithSeconds
NSLog(@"%f", CMTimeGetSeconds(CMTimeMake(3.25, 1))); // 3.000000
NSLog(@"%f", CMTimeGetSeconds(CMTimeMake(3.25 * 100, 100))); // 3.250000
NSLog(@"%f", CMTimeGetSeconds(CMTimeMakeWithSeconds(3.25, 1))); // 3.000000
@gabu
gabu / gist:8050406
Created December 20, 2013 04:26
RubyでJSONのencode/decodeの比較をしてみた結果、ArrayもHashも元に戻る。 さすがにHashのKeyのシンボルはシンボルには戻らなかった。そりゃそうだ感あるけど。
$ irb [~]
irb(main):001:0> require 'json'
=> true
irb(main):002:0> 1.to_json
=> "1"
irb(main):003:0> JSON.load(1.to_json)
=> 1
irb(main):004:0> 1 === JSON.load(1.to_json)
=> true
irb(main):005:0> "hoge" === JSON.load("hoge".to_json)
@gabu
gabu / gist:7809690
Created December 5, 2013 17:29
Sidekiq command optioins
sidekiq [options]
-c, --concurrency INT processor threads to use
-d, --daemon Daemonize process
-e, --environment ENV Application environment
-g, --tag TAG Process tag for procline
-i, --index INT unique process index on this machine
-p, --profile Profile all code run by Sidekiq
-q, --queue QUEUE[,WEIGHT]... Queues to process with optional weights
-r, --require [PATH|DIR] Location of Rails application with workers or file to require
-t, --timeout NUM Shutdown timeout
<activity
android:name=".ui.MainActivity_"
android:label="@string/app_name"
android:uiOptions="splitActionBarWhenNarrow" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
@gabu
gabu / gist:4530500
Created January 14, 2013 14:39
Arduino + USB Host Shield + Bluetooth ドングルでAndroidからBluetooth接続した時のシリアルモニタのログ
Remote Name: Galaxy Nexus
Connected to Device: FC:C7:34:B5:30:DA
Wait For Incoming Connection Request
Bluetooth pin is set too: 0000
Information request
SDP Incoming Connection Request
SDP Configuration Request
SDP Successfully Configured
Disconnected SDP Channel
HCI Disconnected from Device
@gabu
gabu / gist:3309048
Created August 9, 2012 23:36
最近出るようになったLintの警告「This Handler classes should be static or leaks might occur.」を修正したHandlerがこちらになります。 元ネタ: http://stackoverflow.com/a/11408340
private Recipe114Handler mHander;
private static class Recipe114Handler extends Handler {
private final WeakReference<Recipe114Activity> mActivity;
public Recipe114Handler(Recipe114Activity activity) {
mActivity = new WeakReference<Recipe114Activity>(activity);
}
@Override
@gabu
gabu / gist:3261742
Created August 5, 2012 04:49
ちゃんとArrayListの中身までデシリアライズできるから不思議!
public class CopyOfRecipe056Activity extends ListActivity {
ItemAdapter mAdapter;
ArrayList<Item> mItems;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
mItems = new ArrayList<Item>();
@gabu
gabu / gist:2887872
Created June 7, 2012 09:38
Xcode 4.3.2 crash when put Date Picker on the Storyboard
Process: Xcode [924]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 4.3.2 (1177)
Build Info: IDEApplication-1177000000000000~6
Code Type: X86-64 (Native)
Parent Process: launchd [490]
Date/Time: 2012-06-07 18:29:13.447 +0900
OS Version: Mac OS X 10.7.4 (11E53)