Skip to content

Instantly share code, notes, and snippets.

View yasulab's full-sized avatar
💎
\\ Rubyist! //

Yohei Yasukawa yasulab

💎
\\ Rubyist! //
View GitHub Profile
@yasulab
yasulab / adt7410.rb
Last active June 4, 2016 07:43
Get temperature from ADT7410
#!/usr/bin/env ruby
# Sample Output
# pi@raspberrypi:~ $ ruby adt7410.rb
# Path: /dev/i2c-1
# Temp: 29.26
require 'i2c'
I2C_RETRIES = 0x0701
@yasulab
yasulab / pi_piper.rb
Created June 4, 2016 01:56
モールス信号 x Ruby
require 'pi_piper'
include PiPiper
port = 15
pin = PiPiper::Pin.new :pin => port, :direction => :out
dot = 0.2
dash = 1.0
CHAR_TIMING = {
"a" => [dot, dash], "b" => [dash, dot, dot, dot], "c" => [dash, dot, dash, dot],
@yasulab
yasulab / keybindings.settings
Created April 30, 2016 06:31
Keybindings for Cloud9 (~/.c9/keybindings.settings)
// Edit this keymap file and save to apply.
[
{ "command": "gotoend", "keys": { "mac": ["Ctrl-E"] } },
{ "command": "goToNextError", "keys": { "mac": [""] } },
{ "command": "togglerecording", "keys": { "mac": [""] } },
{ "command": "toggleWordWrap", "keys": { "mac": [""] } },
{ "command": "closetab", "keys": { "mac": ["Ctrl-W"] } },
{ "command": "gototableft", "keys": { "mac": ["Ctrl-["] } },
{ "command": "gototabright", "keys": { "mac": ["Ctrl-]"] } },
{ "command": "blockindent", "keys": { "mac": [""] } },
@yasulab
yasulab / keybase.md
Created April 11, 2016 15:49
Keybase - Public key crypto for everyone, publicly auditable proofs of identity.

Keybase proof

I hereby claim:

  • I am yasulab on github.
  • I am yasulab (https://keybase.io/yasulab) on keybase.
  • I have a public key whose fingerprint is 3855 17EF EF4E 021C 8ACB 82D9 9C1A FC61 753B 1C26

To claim this, I am signing this object:

@yasulab
yasulab / rubywarrior.rb
Created October 18, 2013 05:24
One of answers to Ruby Warrior. RubyWarrior https://www.bloc.io/ruby-warrior/
class Player
def play_turn(warrior)
if @health.nil?
# initialize if needed
end
if warrior.feel.empty?
if warrior.health < 20
if @health <= warrior.health # not taking damage
warrior.look.each.with_index do |s,i|
@yasulab
yasulab / simple_comment_viewer.rb
Last active December 18, 2015 10:59
Simple Comment Viewer for ScreenX TV ( http://screenx.tv/ ) なお、投稿にも対応した本格的コメントビューワーはこちらです: https://github.com/aki-017/screenx-commentviewer
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
### Settings
# 1. To use SocketIO, type the following:
# $ gem install socketio-client
require "SocketIO"
# 2. Tune to your channel
# Ex. http://screenx.tv/#{channel}
@yasulab
yasulab / ssd_server.rb
Last active December 14, 2015 10:10
The slides were presented on ScreenX TV using Terminal Keynote. ScreenX TV: http://screenx.tv/ Terminal Keynote: https://github.com/fxn/tkn
# encoding: utf-8
# NOTE: :center, :code, :block, and :section
slide <<-EOS, :center
\e[1m... now preparing ...\e[0m
YASUKAWA, Yohei
@YasuLab
@yasulab
yasulab / README.md
Created February 18, 2013 08:33
Broadcast your terminal to the world using ScreenX TV

Screenshot

ScreenX TV is a web service that lets you broadcast your terminal to the world. It is often used for a hackathon, lecture, and opensource activity. And this gist explains how to broacdcast your terminal using it.

1. Preparation

To install screenxtv command, you can broadcast your terminal anytime, and there are two ways, Ruby and GCC. In both ways, you need to use screen before installing screenxtv command.

To install screenx

@yasulab
yasulab / README.md
Created December 3, 2012 06:29
Install and Run ScreenX TV Client

Description

This script installs and runs ScreenX TV Client using /tmp directory.

Type the following command to run the script:

curl -s -L https://gist.github.com/raw/4193154/ac1905f9f130467d07f3f6dce83f8226983f5df1/install.sh | sh

See ScreenX TV Client repository for details.

@yasulab
yasulab / README.md
Created August 31, 2012 01:52
ScreenX on RackHub - A Real-time Terminal Broadcasting System