This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"keys": ["ctrl+="], | |
"command": "repl_open", | |
"args" : { | |
"type":"subprocess", | |
"external_id":"ruby", | |
"encoding":"utf8", | |
"soft_quit":"\nexit\n", | |
"cwd":"$file_path", | |
"cmd_postfix":"\n", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'benchmark' | |
require "securerandom" | |
namespace :dev do | |
desc "benchmark mem vs redis" | |
task :benchmark => :environment do | |
dev_server = '172.19.60.176' | |
n = 10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'cool.io' | |
class Handler < Coolio::Socket | |
def initialize(io, on_message) | |
super(io) | |
if io.is_a?(TCPSocket) | |
opt = [1, @timeout.to_i].pack('I!I!') # { int l_onoff; int l_linger; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BACKUP_DIR="${HOME}/backup" | |
TMPFILE="/tmp/backup_xtra.tmp" | |
MY_CONF="/etc/my.cnf" | |
XTRABACKUP="/usr/bin/innobackupex" | |
USER="root" | |
PASSWORD="--password=ぱすわーど" | |
LOCKFILE=`basename $0`.lock | |
ON_SLAVE='--slave-info --safe-slave-backup' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// htaccessのかわり | |
$real_file = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']; | |
if (file_exists($real_file)) { | |
return false; | |
} | |
if (!preg_match('/^\/(?:index\.php|images|robots\.txt)/', $_SERVER['REQUEST_URI'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -e "puts STDIN.map{|line| line.split(/ /)}.select{|log| log[-1].to_f > 5.0 }.map{|log| log.join(' ')}" < access.log | |
#色付き | |
ruby -e "puts STDIN.map{|line| line.chomp.split(/ /)}.select{|log| log[-1].to_f > 5.0 }.map{|log| log[-1]=\"\e[31m\"+log[-1]+\"\e[0m\"; log.join(' ')}" < access.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
#-*- mode: ruby-mode;-*- | |
$out_dir = 'build' | |
def run_test | |
system("cd #{$out_dir}; make all && ./a.out -vmodule='hoge=0,foo=2' -logtostderr=1") | |
end | |
watch('CMakeLists.txt'){|md| | |
run_test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std; | |
import core::io; | |
import io::reader; | |
import io::reader_util; | |
import std::sort; | |
impl read_util for reader{ | |
fn read_valid_char() -> char { | |
let mut c; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std; | |
import core::option::{some, none}; | |
import core::option; | |
fn next_permutation<T: copy>(v : [T]) -> option<[T]> { | |
let n = vec::len(v) as int; | |
let nv = vec::to_mut(v); | |
if n < 2 { | |
ret none; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
A = [100, '*', 20, '+', 29, '+', 10, '*', 20, '+', 1, '*', 3, '+', 1, '+', 3, '*', 2] | |
ANS=7005 | |
N = A.size | |
def rep(i, j, a) | |
a.insert(i, '(') |