Skip to content

Instantly share code, notes, and snippets.

View rakuishi's full-sized avatar
🏠
Working from home

OCHIISHI Koichiro rakuishi

🏠
Working from home
View GitHub Profile
# https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b
import hashlib as hasher
import datetime as date
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@rakuishi
rakuishi / gist:37c93b1928cb02713bbd784f6a78f5b7
Last active March 1, 2018 00:14
Install node.js via homebrew
# 確認
$ node -v
# homebrew をインストールしていない場合
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install nodebrew
$ nodebrew -v
$ nodebrew setup
$ nodebrew install-binary v8.9.4
$ nodebrew use v8.9.4
$ echo 'export PATH=$PATH:/Users/rakuishi/.nodebrew/current/bin' >> ~/.bashrc
./gradlew :app:dependencies
@rakuishi
rakuishi / viewpager_lifecycle_sample.java
Last active September 5, 2017 14:05
ViewPager optimized Lifecycle
package com.rakuishi.viewpager_lifecycle_sample;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@rakuishi
rakuishi / nexus6p-oreo.md
Last active August 28, 2017 00:49
Nexus 6P に Android Oreo を導入する
  1. 設定端末情報ビルド番号 を連打して、 開発者向けオプション を表示する
  2. 設定開発者向けオプションOEMロック解除USBデバッグ を ON にする
  3. 端末を USB 接続する
  4. 適当なシステムイメージをダウンロードする https://developer.android.com/about/versions/oreo/download.html#flashable-images
  5. zip ファイルを展開し、ダウンロードしたフォルダに移動する cd angler-opr6.170623.013
  6. $ adb reboot bootloader
  7. $ fastboot flashing unlock 画面が遷移したら、電源ボタン(=YES)を押す
# -*- coding: utf-8 -*-
# $ ruby start-delegated-harvesting.rb 15064
amount = ARGV[0].to_i
vestedBalance = 0
days = 0
if amount <= 10000
puts 'Inputted amount is less than 10,000'
else
@rakuishi
rakuishi / gist:6efaf49411d9dc987f3a97385aea55fe
Last active April 20, 2017 12:27
keytool コマンドの操作方法を毎回忘れる
# Create `debug.keystore` to get an OAuth 2.0 Client ID
$ keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
# Confirm keystore
$ keytool -v -list -keystore debug.keystore
title category source
Trump's Inauguration Speech
English
朝日新聞, 2017年1月22日, 朝刊

Chief Justice Roberts, President Carter, President Clinton, President Bush, President Obama, fellow Americans, and people of the world: thank you.
We, the citizens of America, are now joined in a great national effort to rebuild our country and restore its promise for all of our people.
Together, we will determine the course of America and the world for many, many years to come.
We will face challenges. We will confront hardships. But we will get the job done.

(*
* Before running following codes, this script has to be allowed assistive access.
* System Preferences -> Security & Privacy -> Privacy -> Accessibility
*)
tell application "Finder"
set desktopBounds to bounds of window of desktop
set desktopWidth to item 3 of desktopBounds
set desktopHeight to item 4 of desktopBounds
end tell
@rakuishi
rakuishi / gist:c49680923cd650a2e033557f77cd4d94
Created September 24, 2016 00:41
音声ファイル名が Mac 環境下では文字化けするからシンプルな名前に変更する
# http://www.alc.co.jp/dl/9590521/
$ brew install rename
$ rename 's/(\d*)-(\d*) (.*).mp3/$1-$2.mp3/' *.mp3