This file contains 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/python | |
# You need stereovision package to run this. Try "sudo pip install stereovision" | |
import cv2 | |
from stereovision.blockmatchers import StereoBM, StereoSGBM | |
from stereovision.calibration import StereoCalibration | |
from stereovision.stereo_cameras import CalibratedPair | |
from stereovision.ui_utils import STEREO_BM_FLAG, BMTuner |
This file contains 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
jQuery.ajax({ | |
type: "GET", | |
url: "http://www.geobeats.com/js/selectDropDown.js", | |
data: "cachePreventor=1918606547", | |
async: false, | |
dataType: "text", | |
success: function(data){ | |
var i = "new_cities_array = []; _gbstr = ''; \n"; | |
var f1 = "function addListGroup(a,b){}\n"; | |
var f2 = "function addList(a,b,c,d){ if(a == 'country-place' && b != 'Destination') {var splits = b.split(' - '); new_cities_array.push(splits[1] + ' - ' + splits[0]); _gbstr += (\"<br/>\" + b);} }\n"; |
This file contains 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
# The patch | |
# In the scaffold_field_tags method in helper.rb | |
when :enum | |
# array of select options will be passed in the options hash for this column | |
select_options = options[:select_options] || [] | |
# each item in select_options is like [ option_label, option_value ] | |
s = {value.to_s => "selected='selected'"} | |
options.delete :select_options #we don't want to show this as an attribute in the generated HTML | |
"<select #{scaffold_options_to_html(options)}><option></option>#{select_options.collect{|o| "<option value='#{o[1]}' #{s[o[1]]}>#{o[0].to_s}</option>"}.join}</select>" |
This file contains 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
require 'net/http' | |
require 'uri' | |
require 'csv' | |
google_url = "http://www.google.com/search?q=%22public+wishlist%22+site:flipkart.com&hl=en&site=webhp&prmd=iv&ei=ZYL2TOr3KYLyrQfv4dzWBg&start=NNNN&sa=N&fp=1b624545158a7512&tch=1&ech=1&psi=MX_2TOSlL82BrQegxqDYBg129122283549813" | |
File.open("flipkart-public-wishlists.txt","w") { |f| | |
(0..54).to_a.each { |page| | |
puts "scraping page #{page} from google web search" | |
start = page * 10 |
This file contains 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
require 'net/http' | |
require 'uri' | |
# Fetch list of all stations with their codes | |
File.open("all_stations.csv","w") { |f| | |
(?A..?Z).to_a.collect(&:chr).each { |c| | |
puts "Starting #{c}" | |
sleep(3) #wait for 3 seconds | |
uri = URI.parse("http://www.indiantrains.org/station-list/?navigate=" << c) | |
response = Net::HTTP.get_response(uri) |
This file contains 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 Syllogism | |
attr_accessor :first, :second, :relation, :matrix | |
def initialize(first_term,relation,second_term) | |
@first = first_term | |
@second = second_term | |
@relation = relation | |
@matrix = { @first => :unknown, @second => :unknown, :both => :unknown, :neither => :unknown } | |
@matrix = { @first => :absent, @second => :unknown, :both => :unknown, :neither => :unknown } if @relation == :all_are | |
@matrix = { @first => :unknown, @second => :unknown, :both => :present, :neither => :unknown } if @relation == :some_are | |
@matrix = { @first => :present, @second => :unknown, :both => :unknown, :neither => :unknown } if @relation == :some_are_not |
This file contains 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 | |
#Example usage: mmacmd.rb basicrock 120 4 Bm Bm A A G Em Bm Bm | |
#MMA Website is here: http://www.mellowood.ca/mma/index.html | |
groove = ARGV.slice!(0) | |
tempo = ARGV.slice!(0) | |
count = ARGV.slice!(0) | |
puts "Generating MMA file" | |
File.open("/tmp/mmaout.mma","w") { |f| |
This file contains 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
module ActiveRecord | |
module ConnectionAdapters | |
class MysqlAdapter | |
alias __native_database_types_enum native_database_types | |
def native_database_types #:nodoc | |
types = __native_database_types_enum | |
types[:enum] = { :name => "enum" } | |
types | |
end |
This file contains 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
# TODO | |
# if a var has a value, it also needs a name. This should not be necessary. Variable.initialize should accept hashargs | |
# Expression.to_s should output in infix-notation (like normal humans) | |
# add more syntactic sugar by manipulating Ruby Numeric classes. Add symbolic operators to Ruby's Numeric | |
# If symbolic expression contains variables without value then it should return nil (should it, really?) | |
# Implement additional operators like ** | |
# All symbolic expression should be automatically simplified when created: | |
# cons(0) * x # => 0 | |
# 2 + x + 1 # => x + 3 | |
# -(x-y) + 2*x # => x + y |
This file contains 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
require 'sshkit' | |
require 'sshkit/dsl' | |
# Once "bundle install" has been run, this script can be run as "ruby deploy.rb staging" or "ruby deploy.rb prod" | |
if ARGV.first == "prod" | |
servers = ['deploy@prod1.example.com', 'deploy@prod2.example.com'] | |
elsif ARGV.first == "staging" | |
servers = ['deploy@staging.example.com'] | |
else |
OlderNewer