Skip to content

Instantly share code, notes, and snippets.

View ompugao's full-sized avatar

ompugao

View GitHub Profile
@ompugao
ompugao / narry_ext.rb
Created March 25, 2012 02:45
NArray Extension
require 'narray'
class NArray
class << self
# borrows other dimension lengths from the first object and relies on it to
# raise errors (or not) upon concatenation.
def cat(dim=0,*narrays)
raise ArgumentError, "'dim' must be an integer (did you forget your dim arg?)" unless dim.is_a?(Integer)
raise ArgumentError, "must have narrays to cat" if narrays.size == 0
new_typecode = narrays.map(&:typecode).max
@ompugao
ompugao / ga_ruby.rb
Created March 26, 2012 16:50
ga system written in Ruby
module GaRuby
class GaRubyError < StandardError ; end
class Gene
attr_acessor :data,:value
def initialize(gen_num=nil)
@value=0
if block_given?
@data=Array.new(gen_num){yield}
else
@ompugao
ompugao / jeweler-ruby19.patch
Created April 2, 2012 11:08
patch to a source coded automatically generated by jeweler
diff --git a/Gemfile b/Gemfile
index eedb107..6d26f41 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,7 +8,7 @@ source "http://rubygems.org"
group :development do
gem "rspec", "~> 2.8.0"
gem "rdoc", "~> 3.12"
- gem "bundler", "~> 1.0.0"
+ gem "bundler", ">= 1.0.0"
@ompugao
ompugao / notify_growl.rb
Created May 21, 2012 12:22
earthquake growl notify
require 'ruby_gntp'
Earthquake.init do
output do |item|
next unless item["_stream"]
if item["text"]
GNTP.notify({:app_name => "earthquake",:title => item["user"]["screen_name"],:text => item["text"],:icon => item["user"]["profile_image_url"]})#icon_path(user.screen_name, user.profile_image_url) })
#if /@sifikinoko(?:[\s:]|$)/ =~ item["text"]
# system{
# 'notify-send',
# '--urgency','critical',

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@ompugao
ompugao / xstartup
Created September 6, 2012 14:09
ubuntu vncserver xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
/bin/sh /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
@ompugao
ompugao / gollum.conf
Created September 7, 2012 14:30 — forked from leon/gollum.conf
Gollum Upstart script
#
# Install:
# install https://github.com/github/gollum
# in /srv/wiki do a git init
# add this script to /etc/init/gollum.conf
#
# Usage:
# start/stop/restart gollum
#
@ompugao
ompugao / fasd.vim
Created September 23, 2012 10:34
fasd integration to vim
" Z - cd to recent / frequent directories
command! -nargs=* Z :call Z(<f-args>)
function! Z(...)
let cmd = 'fasd -d -l -e printf'
for arg in a:000
let cmd = cmd . ' ' . arg
endfor
let pathes = split(system(cmd),"\n")
for i in range(0,len(pathes)-1)
echo i ." " . pathes[i]
@ompugao
ompugao / rosvim.vim
Created October 8, 2012 06:36
ros integration to vim
" Vim global plugin for working with ROS
" Maintainer: Michael Styer <michael@styer.net>
" Fixed by : Fujii Shohei <fujii.shohei@gmail.com>
" Helper commands
function! s:RosDecodePath(path)
let rosname = ""
let reldir = ""
let rosdir = ""
let last = ""
@ompugao
ompugao / config
Last active October 13, 2015 03:57
termtter config
# -*- coding: utf-8 -*-
# vim: filetype=ruby
config.token_file = "~/.termtter/token"
#config.dmsg_permission = true
config.update_interval = 30
config.timeout = 60
#config.retry = 3
#config.enable_ssl = true