Skip to content

Instantly share code, notes, and snippets.

View masutaka's full-sized avatar

Takashi Masuda masutaka

View GitHub Profile
@masutaka
masutaka / init.el
Created September 16, 2012 17:05
A dictionary tool which can switch Mac dictionary, sdic and commandline-dictionary-app.
;; http://www.namazu.org/~tsuchiya/sdic/index.html
(require 'sdic)
;; hg clone http://hg.pqrs.org/commandline-dictionary-app
(defvar dict-bin "/Users/masutaka/repository/commandline-dictionary-app/src/dict"
"a path of commandline-dictionary-app")
(defun dictionary-app (word)
"Display the meaning of word using Dictionary.app."
(interactive (list (sdic-read-from-minibuffer)))
@masutaka
masutaka / init.el
Created December 11, 2012 14:21
anything-for-elscreen
(defun anything-for-elscreen ()
"preconfigured `anything' for anything-for-elscreen"
(interactive)
(anything anything-c-source-elscreen
nil nil nil nil "*anything for elscreen*"))
(define-key global-map (kbd "s-e") 'anything-for-elscreen)
@masutaka
masutaka / init.el
Last active December 11, 2015 02:18
open-chalow
(defun open-chalow ()
"Open the URL that is matched the article under the cursor"
(interactive)
(let ((date-regexp "^\\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\)")
(date)
(entry-id 1)
(current (point)))
(save-excursion
(setq date (and (re-search-backward date-regexp (point-min) t)
(match-string-no-properties 1))))
@masutaka
masutaka / cl.conf.pl
Last active December 11, 2015 02:18
chalow plugins
### Link to the Twitter account
# usage: {{twitter('ACCOUNT')}}
# Ex. {{twitter('masutaka')}}
sub twitter {
my ($account) = @_;
return qq(<a href="https://twitter.com/${account}" target="_blank">\@${account}</a>);
}
### Embedded Tweet
@masutaka
masutaka / default.rb
Last active December 19, 2015 20:09
The Chef recipe `plenv + cpanm + carton`
git '/home/masutaka/.plenv' do
repository 'git://github.com/tokuhirom/plenv.git'
reference 'master'
user 'masutaka'
group 'masutaka'
action :sync
end
directory '/home/masutaka/.plenv/plugins' do
owner 'masutaka'
@masutaka
masutaka / cpanfile
Last active December 21, 2015 01:19
A chef recipe of GrowthForecast
requires 'GrowthForecast';
@masutaka
masutaka / default.rb
Last active December 21, 2015 02:58
Nginx(LTSV log) -> fluentd -> MongoDB
gem_package 'fluent-plugin-mongo' do
gem_binary '/usr/lib/fluent/ruby/bin/fluent-gem'
action :install
end
@masutaka
masutaka / default.rb
Last active December 21, 2015 02:58
Nginx(LTSV log) -> fluentd -> (MongoDB and GrowthForecast)
%w(fluent-plugin-mongo fluent-plugin-growthforecast).each do |pkg|
gem_package pkg do
gem_binary '/usr/lib/fluent/ruby/bin/fluent-gem'
action :install
end
end
@masutaka
masutaka / default.rb
Created August 15, 2013 05:40
Nginx(LTSV log) -> fluentd -> (MongoDB and GrowthForecast) part2
%w(fluent-plugin-mongo fluent-plugin-growthforecast fluent-plugin-datacounter).each do |pkg|
gem_package pkg do
gem_binary '/usr/lib/fluent/ruby/bin/fluent-gem'
action :install
end
end
@masutaka
masutaka / gist:7217576
Last active December 26, 2015 21:39
a sample of getting my Foursquare checkin histories
require 'foursquare2'
client = Foursquare2::Client.new(:oauth_token => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
client.user_checkins({'offset' => 0, 'limit' => 30})[:items].each do |checkin|
name = checkin[:venue][:name]
lng = checkin[:venue][:location][:lng]
lat = checkin[:venue][:location][:lat]
printf "%s %f %f\n", name, lng, lat
end