Skip to content

Instantly share code, notes, and snippets.

View oshinko's full-sized avatar

Oshinko oshinko

View GitHub Profile
@oshinko
oshinko / install-vertx.sh
Created April 8, 2016 00:43
Install vert.x.
export TARGET_VERTX_VERSION='3.2.1'
cd $HOME
curl -L -O https://bintray.com/artifact/download/vertx/downloads/vert.x-$TARGET_VERTX_VERSION.tar.gz
tar zxvf vert.x-$TARGET_VERTX_VERSION.tar.gz
rm vert.x-$TARGET_VERTX_VERSION.tar.gz
export PATH=$HOME/vertx/bin:$PATH
echo 'Ready for running!'
vertx --version
@oshinko
oshinko / MainActivity.java
Last active April 17, 2017 05:32
リクエストヘッダを指定してブラウザを開く
package activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Browser;
import android.support.v7.app.AppCompatActivity;
import BuildConfig;
import R;
@oshinko
oshinko / bots.py
Last active June 28, 2017 17:03
Coroutine Event Loops for UDP in Python 3.
# python3 bots.py localhost 8080 100 4 1
import random
import select
import socket
import sys
import time
from datetime import datetime
eventmask = select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR
using Messengers.Udp;
using System.Net;
using System.Threading;
using UnityEngine;
namespace UdpExample.Client
{
public class DevServer : MonoBehaviour
{
public Messenger Messenger;
import csv
from easydict import EasyDict
default_reader = csv.DictReader
def load_tsv(path, reader=default_reader):
return load_csv(path, delimiter='\t', reader=reader)
import json
import re
import sys
def repl(match):
return ':"{0}"{1}'.format(
match.group(1),
match.group(2))
text = re.sub(r':([0-9A-Za-z]+)([,}])', repl, sys.stdin.readline())
@oshinko
oshinko / install-opencv-on-debian.sh
Created August 5, 2017 03:04
Install OpenCV on Debian
sudo apt-get -y install libopencv-dev python-opencv
@oshinko
oshinko / uitest.py
Last active August 6, 2017 04:35
Automated GUI Testing with OpenCV.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from cvwrapper import AndroidAgent, Image
# Create agent
agent = AndroidAgent()
# Capture image
image = agent.capture()
@oshinko
oshinko / redis_snowflake.py
Last active October 14, 2017 04:03
Redis Snowflake for Python.
import redis
import time
def snowflake(redis, epoch=0):
return redis.register_script(f"""
local node = tonumber(redis.call('HGET', 'globals', 'node')) % 1024
local seq = tonumber(redis.call('HINCRBY', 'globals', 'sequence', 1)) % 4096
local time = redis.call('TIME')
local time41 = ((tonumber(time[1]) * 1000) + (tonumber(time[2]) / 1000)) - {epoch}
@oshinko
oshinko / bitcoin-on-debian-android.md
Last active June 27, 2018 12:11
Running Bitcoin on Debian Android

Android GNURoot Debian

Installation (Your Computer)

cd Downloads
adb shell pm list packages -f | grep gnuroot
adb pull /data/app/com.gnuroot.debian-1/base.apk com.gnuroot.debian.apk
adb install com.gnuroot.debian.apk
curl -O https://github.com/corbinlc/GNURootDebian/blob/master/GNURootDebianSource/src/armhf/obb/main.10.com.gnuroot.debian.obb?raw=true
adb shell mkdir -p /sdcard/Android/obb/com.gnuroot.debian