Skip to content

Instantly share code, notes, and snippets.

adduser 3.113ubuntu2
apt 0.8.16~exp12ubuntu10.2
apt-utils 0.8.16~exp12ubuntu10.2
aspell 0.60.7~20110707-1
aspell-en 6.0-0-6ubuntu2
autoconf 2.68-1ubuntu2
automake 1:1.11.3-1ubuntu2
autotools-dev 20120210.1ubuntu1
base-files 6.5ubuntu6.2
base-passwd 3.5.24
iced@iced test % cat test.worker
exec 'test.rb'
iced@iced test % cat test.rb
puts config.inspect
puts "YO!"
iced@iced test % iron_worker upload test --worker-config test.json
------> Creating client
Project 'Test' with id='517baf16ed3d7607990013a0'
------> Creating code package
Found workerfile with path='test.worker'
@onewheelskyward
onewheelskyward / generate-hombrew-install-commands.rb
Last active February 16, 2024 08:57
brew reinstall commands
brews = []
out = IO.popen("brew list", "r") do |io|
brews = io.read.split "\n"
end
def parse(brew, brew_info)
in_options = false
print "brew reinstall -v #{brew} "
brew_info.split("\n").each do |m|
#puts m.inspect
@dbc-challenges
dbc-challenges / fgist.rb
Last active December 16, 2015 02:09
save this toyour ~/bin directory as "fgist" then run "chmod +x ~/bin/fgist" then make sure ~/bin is on your $PATH This will download all the contents of a gist to your current directory, given a gist url. run as: fgist https://gist.github.com/dbc-challenges/5360499
#!/usr/bin/env ruby
require 'net/https'
require 'json'
# a simple wrapper to do an HTTP GET
def fetch_uri(uri)
uri = URI(uri)
Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@YayC
YayC / My_Shortcuts.md
Last active December 13, 2015 22:18
Some ST2 and OSX time savers that I use (as of the first night of Dev Bootcamp). Boosting the productivity of a total novice, give 'em a spin.

J's Essential Keyboard Shortcuts


ST2, Terminal, and OSX

If you haven't seen one of these, try it out! Well documented but these are the ones I use consistently.

⇧ = shift, ⌃ = ctrl, ⌥ = option, ⌘ = command (aka master)

Sublime Text 2

What an awesome tool.

@eric1234
eric1234 / README.md
Last active December 11, 2015 22:08
S3 - Set permissions public on all files in a bucket using IronWorker.

Purpose

Workers to ensure all objects in a S3 bucket have the 'public-read' canned ACL permission. Designed to work with iron.io's IronWorker product to use it's scalable workers to set the permissions quickly and afforably.

Setup

@kmandreza
kmandreza / Calculating the array mode
Created January 2, 2013 03:30
Write a method mode which takes an Array of numbers as its input and returns an Array of the most frequent values. If there's only one most-frequent value, it returns a single-element Array. For example, mode([1,2,3,3]) # => [3] mode([4.5, 0, 0]) # => [0] mode([1.5, -1, 1, 1.5]) # => [1.5] mode([1,1,2,2]) # => [1,2] mode([1,2,3]) # => [1,2,3], b…
def mode(array)
count = Hash.new(0)
array.each { |element| count[element] += 1 } #count how many times an element[s] appears the most
# element of the array => number of times element occured in an array
# ex. {5 => 2, 6 =>2, 7 =>1}
max = count.values.max
count.keep_if { |key, val| val == max}
# count is {5 => 2, 6 =>2}
count.keys #return an array of those elements
end
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 09:32
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@broccolini
broccolini / frontage.css
Created May 31, 2012 18:23 — forked from nrrrdcore/frontage.css
Outlined Type Effect with CSS Text-Shadowing
body {
background-color: #7A060C;
}
#wrapper {
width: 90%;
margin: 200px auto;
}
h1 {