The fool proof network copy & paste program. Well, maybe someday.
> nwcopy /Users/josh/Dropbox/nwcopy/f314eee55161b14f140ee07b358ba63ef54112ac > nwpaste https://github.com/j05h/nwcopy
| >> import random | |
| >>> respostas_do_guru = ["sim", "nao", "talvez"] | |
| >>> random.choice(respostas_do_guru) | |
| 'nao' |
| #!/bin/sh | |
| # | |
| # init.d script for single or multiple unicorn installations. Expects at least one .conf | |
| # file in /etc/unicorn | |
| # | |
| # Modified by [email protected] http://github.com/jaygooby | |
| # based on http://gist.github.com/308216 by http://github.com/mguterl | |
| # | |
| ## A sample /etc/unicorn/my_app.conf | |
| ## |
| #!/bin/sh | |
| # | |
| # init.d script for single or multiple unicorn installations. Expects at least one .conf | |
| # file in /etc/unicorn | |
| # | |
| # Modified by [email protected] http://github.com/jaygooby | |
| # based on http://gist.github.com/308216 by http://github.com/mguterl | |
| # | |
| ## A sample /etc/unicorn/my_app.conf | |
| ## |
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'mechanize' | |
| def download path, site | |
| url = "http://reddpics.com/moreimages/#{site}/#{path}" | |
| agent = Mechanize.new | |
| page = agent.get url | |
| page.links_with(:href => /i.imgur.com/).map(&:href).uniq.each do |img| |
| #!/usr/bin/env ruby | |
| # This class will check search rubygems.org for all gems in a given Gemfile. | |
| # If a given gem is not available on rubygems.org, it will tell you such. | |
| class VerifyGems | |
| def initialize _file, _source | |
| @file = _file || 'Gemfile' | |
| @source = _source || 'http://rubygems.org' | |
| @gems = [] | |
| @verbose = false |
The fool proof network copy & paste program. Well, maybe someday.
> nwcopy /Users/josh/Dropbox/nwcopy/f314eee55161b14f140ee07b358ba63ef54112ac > nwpaste https://github.com/j05h/nwcopy
| class Numeric | |
| def to_rad | |
| self * Math::PI / 180 | |
| end | |
| end | |
| # http://www.movable-type.co.uk/scripts/latlong.html | |
| # loc1 and loc2 are arrays of [latitude, longitude] | |
| def distance loc1, loc2 | |
| lat1, lon1 = loc1 |
| module Crypto | |
| class UnexpectedAlgorithmException < Exception | |
| end | |
| class << self | |
| def hashtext thing, *extras | |
| Digest::SHA1.hexdigest(([thing] + extras).join(" ")) | |
| end | |
| # Always returns a different hex salt, using +extras+ for added |
| # this is a stupid simple random stringifier | |
| "#{10.times.map{(rand(26) + 97).chr}.join}_#{Time.now.to_i.to_s}" | |
| #=> "qnoqszbiam_1285701912" |
| class A | |
| class B | |
| def self.const_get(n) | |
| self.const_set(n,Class.new(self){ | |
| self.const_set("D",Class.new(self)) | |
| }) | |
| end | |
| end | |
| end | |
| puts A::B::C::D rescue puts $! |