Create and store a 512-byte random encryption key named secret:
$ mkkey secret
Encrypt the contents of file with the secret key and write it to file.enc:
$ encrypt secret < file > file.enc
| module DefaultValues | |
| def has_default_values(default_values = {}) | |
| cattr_accessor :default_values | |
| self.default_values = default_values | |
| after_initialize :assign_default_values | |
| include InstanceMethods |
| module Celluloid | |
| class Thread < ::Thread | |
| def []= key, value | |
| if key_on_thread? key | |
| thread_vars[key] = value | |
| else | |
| super | |
| end | |
| end |
| def required(arg=nil) | |
| method = caller_locations(1,1)[0].label | |
| raise ArgumentError.new("required parameter #{arg.to_sym.inspect + ' ' if arg}not passed to method #{method}") | |
| end | |
| def say(greeting: required('greeting')) | |
| puts greeting | |
| end | |
| def say2(greeting: required) |
| module BinaryFileStringUtils | |
| def byte_to_int | |
| self.unpack('U').first | |
| end | |
| def little_endian_to_int | |
| # source : http://stackoverflow.com/questions/5236059/unpack-signed-little-endian-in-ruby | |
| arr, bits, num = self.unpack('V*'), 0, 0 | |
| arr.each do |int| | |
| num += int << bits |
| class Module | |
| # We often find ourselves with a medium-sized chunk of behavior that we'd | |
| # like to extract, but only mix in to a single class. | |
| # | |
| # We typically choose to leave the implementation directly in the class, | |
| # perhaps with a comment, because the mental and visual overhead of defining | |
| # a module, making it a Concern, and including it is just too great. | |
| # | |
| # | |
| # Using comments as lightweight modularity: |
| #!/usr/bin/env ruby | |
| # API Documentation at http://api.wikia.com/wiki/LyricWiki_API | |
| require 'open-uri' | |
| require 'json' | |
| require 'tmpdir' | |
| ARTIST = "Johnny Cash" |
Locate the section for your github remote in the .git/config file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
| require "rest_client" | |
| require "twitter" | |
| URL = "http://www.oge.com/residential-customers/products-and-services/" + | |
| "Positive-Energy-Smart-Grid/Pages/PriceSignal.aspx" | |
| DATE_RE = Time.now.strftime("%A,\\s+%B\\s+%d,\\s+%Y") | |
| unless ARGV.size == 4 | |
| abort "USAGE: #{$PROGRAM_NAME} CONSUMER_KEY CONSUMER_SECRET " + | |
| "OAUTH_TOKEN OAUTH_TOKEN_SECRET" |