Skip to content

Instantly share code, notes, and snippets.

View neidiom's full-sized avatar
🌴
On vacation

Nedim Hadzimahmutovic neidiom

🌴
On vacation
View GitHub Profile
@juno
juno / github-api-practice.rb
Created January 22, 2011 12:49
w/HTTParty
require 'json'
require 'httparty'
class Github
include HTTParty
base_uri 'http://github.com/api/v2/json'
# @param [String] username GitHub username
# @param [String] password Password or API token
def initialize(username, password)
@dustMason
dustMason / SpecifyAPI.rb
Created February 25, 2011 22:35
Simple API wrapper for Specify using HTTParty and HTTMultiParty
require 'rubygems'
require 'httparty'
require 'HTTMultiParty'
require 'base64'
# This is a quick example to demonstrate the use of ruby to interact with the Specify API.
# I am a beginner rubyist, so please excuse my rudimentary code!
# Depends on httparty for clean and simple API wrapper code https://github.com/jnunemaker/httparty
# Depends on httpmultiparty to allow image and file uploads https://github.com/jwagener/httmultiparty
@boundvariable
boundvariable / example_node.json
Created June 30, 2011 01:04
Puppet node definitions via CouchDB
{
"_id": "a58af3e3e43733657152f59865021e0f",
"_rev": "28-c7d4a44d4c176886cf742ebec4876550",
"classes": [
"balancer"
],
"host": "example.com",
"directors": [
{
"name": "temp",
@bradly
bradly / deploy.rake
Created July 27, 2011 03:58
Simple Rails Deployments with Net/SSH
require 'net/ssh'
desc "Deploy site to production"
task :deploy => :environment do
host = 'yourhost.com'
user = 'username'
options = {:keys => '~/.ssh/keys/yourserver.pem'}
remote_path = '/path/to/rails_app'
commands = [
@fduran
fduran / gist:1870554
Created February 20, 2012 18:34
Linux disk/memory stress test
# www.fduran.com
# hardware stress test
# mismatched md5sums shows a faulty disk/RAM
# time depends on hardware, ex: 1 sec per 100 count
dd if=/dev/zero of=/tmp/test.file bs=1M count=1000
for i in {1..5}; do md5sum /tmp/test.file; done
@halkeye
halkeye / sorted_json.rb
Created April 2, 2012 23:13
Puppet module for outputting json in a sorted consistent way
#
# sorted_json.rb
# Puppet module for outputting json in a sorted consistent way. I use it for creating config files with puppet
require 'json'
def sorted_json(json)
if (json.kind_of? String)
return json.to_json
elsif (json.kind_of? Array)
@btoone
btoone / credentials.yml
Created April 3, 2012 01:54
Prototype for a gist library using httparty
:username: caspyin
:password: PASSWD
@hammackj
hammackj / backup_rsync.rb
Created July 3, 2012 04:42
Simple ruby script to backup a home directory via rsync and suspend/start VMs before/after
#!/usr/bin/env ruby
REMOTE_HOST = ""
USER = ""
SOURCE = ""
DESTINATION = "backup/"
vm_list = `vmrun list`.split("\n")
vm_list.shift
@j7
j7 / basecamp.rb
Created September 8, 2013 12:38
Skinny Basecamp API Wrapper in Ruby ( BCX )
# User omniauth with the omniauth-basecamp strategy to authenticate. And, store the token that you receive.
# To connect to the API create an instance of the wrapper:
# @basecamp = Basecamp.new(token), at this point only .accounts will work, use that get the account
# id of the account you want to connect. After that, just passs the accout id to the connection, @basecamp = Basecamp.new(token, account_id)
# and feel free to call any method.
#
# By Javier Carballo, javier@javier.im.
class Basecamp
def initialize(token, account_id = nil, app = nil)
@token = token
@tamirko
tamirko / site.pp
Last active October 16, 2016 07:59
site.pp
if $cloudify_service != undef {
case $cloudify_service {
'mysql' : {
class { '::mysql::server':
root_password => 'strongpassword',
}
}
}
}