Skip to content

Instantly share code, notes, and snippets.

View ryuone's full-sized avatar

Ryuichi Maeno ryuone

View GitHub Profile
@ryuone
ryuone / gist:4570750
Created January 19, 2013 04:32
こんな感じ
iptables -F
iptables -X
iptables -Z
iptables -P INPUT DROP # 受信はすべて破棄
iptables -P OUTPUT ACCEPT # 送信はすべて許可
iptables -P FORWARD DROP # 通過はすべて破棄
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
@ryuone
ryuone / .zshrc.sample
Last active December 13, 2015 21:28
.zshrc
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
autoload -Uz compinit
compinit
autoload colors
colors
@ryuone
ryuone / tmuxDev.sh
Created June 6, 2013 16:14
Create Tabs and Panes for tmux.
#!/bin/bash
SESSION_NAME="TmuxSession"
TMUX_TABS=2
TMUX_PANES=16
tmux start-server
if ! $(tmux has-session -t "${SESSION_NAME}"); then
cd ~/
url = "http://www.yahoo.co.jp/"
qrcode = :qrcode.encode(url)
{:ok, fd} = :file.open('./yahoo.qr.png', [:write, :raw, :binary])
:file.write(fd, :qrcode_demo.simple_png_encode(qrcode))
:file.sync(fd)
:file.close(fd)
@ryuone
ryuone / math_random.js
Last active December 21, 2015 08:09
Math.random duplicate check.
var store = {}
for(var i=0, imax=60000; i<imax; i++){
var mRandom = Math.random() + "";
if(!store[mRandom]){
store[mRandom] = true;
continue;
}else{
console.log("Duplicate : " + mRandom + " -> " + i);
}
}

Create

brunch new gh:damassi/Coffeescript-App-Skeleton urlLists
brunch new gh:brunch/simple-coffee-skeleton urllist
brunch new gh:paulmillr/brunch-with-chaplin urllist

Get skelton from

https://github.com/brunch/brunch/wiki/Skeletons

Document

brunch : https://github.com/brunch/brunch/tree/stable/docs

var socketio = require("socket.io");
io.sockets.on("connection", function (socket) {
// Get client's ip address.
console.dir(socket.manager.handshaken[socket.id].address.address)
// Get client's user-agent.
console.dir(socket.manager.handshaken[socket.id].headers['user-agent'])
}
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
// this function opens the websocket and will trigger add_point when
// a new message is received
Stream = function () {
_.extend(this, Backbone.Events);
var self = this;
self.socket = new WebSocket("ws://" + document.domain + ":5000/websocket");
console.log("Using a standard websocket");
self.socket.onopen = function(e) {
ExUnit.start
# defprotocol Comparable do
# @only [BitString]
# def be(left,right)
# def le(left,right)
# def left <= right
# end
# defimpl Comparable, for: BitString do