Skip to content

Instantly share code, notes, and snippets.

##################### ElasticSearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/reference/setup/installation.html>.
#
# ElasticSearch comes with reasonable defaults for most settings,
@wulab
wulab / pool.csv
Last active December 10, 2015 05:18
ing jo 1
ing lhung 0
ing north 1
ing nut 1
ing phat 0
ing pon 1
ing sunny 0
jo lhung 0
jo north 1
jo nut -1
@wulab
wulab / pool.yml
Last active December 10, 2015 10:08
---
company: oozou
players:
- ing
- jo
- lhung
- north
- nut
- phat
- pon
http://stackoverflow.com/questions/6594558/when-i-create-a-virtualenv-python-runs-in-64-bit-even-when-already-set-to-32-bi
https://github.com/gldnspud/virtualenv-pythonw-osx/
1 virtualenv -p /usr/local/Cellar/python/2.7.5/bin/python env
2 source env/bin/activate
3 file `which python`
4 arch -i386 python install_pythonw.py `which python`/../..
5 file `which pythonw`
6 pip freeze
7 pip install pyglet
class String
def translate(from_str, to_str)
IO.popen(["python", "-c", <<-CMD.gsub(/^\s{6}/,"")]) { |f| f.read.chomp }
import string
print '#{self}'.translate(string.maketrans('#{from_str}','#{to_str}'))
CMD
end
end
class Complement
@wulab
wulab / weather_o_rama.rb
Last active August 6, 2018 10:45
Weather-O-Rama Inc.’s next generation, Internet-based Weather Monitoring Station
module Subject
def register_observer()
raise NotImplementedError
end
def remove_observer()
raise NotImplementedError
end
def notify_observers()
@wulab
wulab / starbuzz_ordering_systems.rb
Created September 19, 2014 17:30
Starbuzz Coffee Ordering Systems
class Beverage
attr_reader :description
def initialize()
@description = "Unknown beverage"
end
def cost()
raise NotImplementedError
end
@wulab
wulab / index.rhtml
Last active August 29, 2015 14:06
Running Servlets with WEBrick
<pre>
Request to <%= servlet_request.request_uri %>
Query params <%= servlet_request.query.inspect %>
</pre>
require 'prime'
class Raindrops
def self.convert(number)
factors = number.prime_division.to_h.keys & [3, 5, 7]
return number.to_s if factors.empty?
factors.join.tr('357', 'iao').gsub(/(\w)/, 'Pl\1ng')
end
end
@wulab
wulab / repl.rb
Last active August 29, 2015 14:09
A Simple Ruby REPL (thanks to citizen428!)
trap('INT') { puts; exit }
loop { print ">> "; puts "=> %s" % eval(gets.chomp!) }