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
# -*- mode: ruby -*- | |
VAGRANTFILE_API_VERSION = "2" | |
SERVERS = [ | |
{ hostname: "storm", ssh_forward: 2302, networks: [ { ip: "192.168.0.2", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "nimbus", ssh_forward: 2303, networks: [ { ip: "192.168.0.3", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server1", ssh_forward: 2304, networks: [ { ip: "192.168.0.4", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server2", ssh_forward: 2305, networks: [ { ip: "192.168.0.5", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server3", ssh_forward: 2306, networks: [ { ip: "192.168.0.6", virtualbox__intnet: "storm" } ] }, | |
] |
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 | |
require 'pp' | |
def shuffle(array) | |
i = array.length | |
while 0 < i | |
i = i - 1 | |
j = (Random.rand * i).to_i | |
array[i], array[j] = array[j], array[i] |
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
(2..36).each do |base| | |
n = '1' * (base - 1) | |
puts "base: #{base} #{n} * #{n} = #{(n.to_i(base) ** 2).to_s(base)}" | |
end |
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 -*- | |
words = %w(ボ ン ジョ ヴィ) | |
targets = %w(ジョ ン ボ ン ジョ ヴィ) | |
recent = [] | |
num_generate = 0 | |
begin | |
num_generate += 1 |
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
class String | |
def undump | |
self.sub(/\A"/, '').sub(/"\z/, '').gsub(/\\(x([0-9a-f]{2})) | \\(u\{([0-9a-f]{4})\}) | \\(.) /ix) { | |
if $1 # \xXX | |
[$2.hex].pack("C") | |
elsif $3 # \u{xxxx} | |
[$4.hex].pack("U") | |
else # \. | |
case $5 | |
when 't' |
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
(define-key minibuffer-local-filename-completion-map "\C-l" '(lambda () (interactive) (insert-string (concat (helm-reduce-file-name (delete-and-extract-region (minibuffer-prompt-end) (point-max)) 1 ) "/")))) |
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
(defun dev-gitweb-diff-url-from-magit () | |
(interactive) | |
(let* ( | |
(branch (magit-get-current-branch)) | |
(remote (and branch (magit-get "branch" branch "remote"))) | |
(remote-rebase (and branch (magit-get-boolean "branch" branch "rebase"))) | |
(remote-branch (or (and branch (magit-remote-branch-for branch)) branch)) | |
(remote-string (and remote remote-branch (magit-remote-string remote remote-branch remote-rebase))) | |
(remote-url (and remote (magit-get "remote" remote "url"))) |
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
#!perl | |
use strict; | |
use warnings; | |
BEGIN{ | |
# $ENV{XSLATE} = ' dump=ast '; # @@@ @@@ | |
} | |
use Text::Xslate; |
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
# -*- mode: snippet -*- | |
# name: package | |
# key: package | |
# -- | |
package ${1:`(if (string-match "/lib/\\(.*\\)\\.pm" buffer-file-name) (replace-regexp-in-string "/" "::" (match-string 1 buffer-file-name)) "")`}; | |
use strict; | |
use warnings FATAL => qw(all); | |
$0 |
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
(defun toggle-camelcase-and-snakecase () | |
(interactive) | |
(let (start end bounds) | |
(if (and transient-mark-mode mark-active) | |
(progn | |
(setq start (mark)) | |
(setq end (point))) | |
(let ((bounds (bounds-of-thing-at-point 'symbol))) | |
(when bounds |