Skip to content

Instantly share code, notes, and snippets.

View riseshia's full-sized avatar
🐱

Shia riseshia

🐱
View GitHub Profile
@riseshia
riseshia / ssh-multi.sh
Created March 12, 2019 08:41 — forked from corny/ssh-multi.sh
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi.sh - a script to ssh multiple servers over multiple tmux panes
# usage: type tmux then from inside tmux type ssh-multi.sh HOST1 HOST2 ... HOSTN
# Muayyad Alsadi, D.Kovalov
# https://gist.github.com/muayyad-alsadi/bd25845776bb6b4185ba/
# https://gist.github.com/dmytro/3984680
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# Tested with Ubuntu 16.04 and tmux 2.1
function error() {
#!/usr/bin/env bash
# Opens the github page for a repo/branch in your browser.
# https://github.com/paulirish/git-open/
#
# git open
# git open [remote] [branch]
# are we in a git repo?
@riseshia
riseshia / some_case.rb
Created August 28, 2016 05:27
simple example
class Task
attr_accessor :done_flg
def done?
done_flg
end
end
class TaskTest
test "done? returns true" do
@riseshia
riseshia / voodoo.sh
Created January 4, 2016 12:35
Customized Voodoo Privacy
#!/bin/sh
#
# EDIT based on https://github.com/sarfata/voodooprivacy/blob/master/voodoo-vpn.sh
#
# voodoo-vpn.sh: Amazon EC2 user-data file for automatic configuration of a VPN
# on a Ubuntu server instance. Tested with 12.04.
#
# See http://www.sarfata.org/posts/setting-up-an-amazon-vpn-server.md
#
# DO NOT RUN THIS SCRIPT ON YOUR MAC! THIS IS MEANT TO BE RUN WHEN
@riseshia
riseshia / Scoreboard.rb
Created January 28, 2015 04:38
Bowling Scoreboard
###########
## Usage ##
#
# puts Scoreboard.score([[10,0],[10,0],[10,0],[8,2],[7,3],[9,1],[7,2],[3,0],[7,2],[6,3,0]])
# puts Scoreboard.score([[10,0],[10,0],[10,0],[8,2],[7,3],[9,1],[7,2],[3,0],[7,2],[6,0],[3,0],[0,0]])
# puts Scoreboard.score([10,10,10,8,2,7,3,9,1,7,2,3,0,7,2,6,3,0])
#
###########
class Scoreboard

Backbone.js handsOn

  • Ruby : 2.2.0
  • Rails : 4.1.7
  • backbone-on-rails : 1.1.2.0
  • jQuery : 1.11.2

Preparing

Create App

@riseshia
riseshia / calculator_with_regexp
Created November 20, 2014 11:26
Simple calculator with regexp
def cal(expr)
while(true)
matched = /(\d+)(\*)(\d+)/.match(expr)
expr.gsub!(matched[0],"#{matched[1].to_i * matched[3].to_i}") if matched
matched = /(\d+)(\/)(\d+)/.match(expr)
return "Error!" if matched and matched[3] == "0"
expr.gsub!(matched[0],"#{matched[1].to_i / matched[3].to_i}") if matched
matched = /(\d+)(\+)(\d+)/.match(expr)