Skip to content

Instantly share code, notes, and snippets.

View garo's full-sized avatar

Juho Mäkinen garo

View GitHub Profile
root@testipannu-1:/data/data/profiles/test-246401d041c711e69af6970683addfb4# ls -l
total 36
drwxr-xr-x 2 root root 6 Jul 4 09:10 backups
-rw-r--r-- 1 root root 43 Jul 4 09:28 la-1-big-CompressionInfo.db
-rw-r--r-- 1 root root 266 Jul 4 09:28 la-1-big-Data.db
-rw-r--r-- 1 root root 10 Jul 4 09:28 la-1-big-Digest.adler32
CREATE TABLE test (
office text,
office_team text,
ts timestamp,
team_member text,
action text,
is_team_active boolean static,
PRIMARY KEY ((office, office_team), ts, team_member)
);
class Context
attr_accessor :foo
attr_accessor :bar
def to_s
"[Context: foo: #{foo}, bar: #{bar}]"
end
end
require "pp"
require "sinatra/base"
# A blank Sinatra app
class SinatraApp < Sinatra::Base
configure do
set :server, :puma
end
end
class SinatraApp < Sinatra::Base
get '/test' do
"This works\n"
end
end
app = SinatraApp.new
# How to create a new routes into the app now? I would like to do something like this:
app.get "/hello" do
require 'sinatra/base'
require 'puma'
require 'rack'
require 'rack/server'
# Our simple hello-world app
class HelloApp < Sinatra::Base
configure do
set :server, :puma
@garo
garo / fib.cpp
Created February 27, 2015 18:29
#include <iostream>
template <unsigned N>
struct Fibonacci
{
enum
{
value = Fibonacci<N-1>::value + Fibonacci<N-2>::value
};
/*
Send a Start/Sop Recording command to the LANC port of a video camera.
Tested with a Canon XF300 camcorder
This code requires a simple interface see http://micro.arocholl.com
Feel free to use this code in any way you want.
Comprehensive LANC info: www.boehmel.de/lanc.htm
"LANC" is a registered trademark of SONY.
CANON calls their LANC compatible port "REMOTE".
credentials = data_bag_item "credentials", "aws"
aws_ebs_volume device do
aws_access_key credentials["aws_access_key_id"]
aws_secret_access_key credentials["aws_secret_access_key"]
device device
action [ :create, :attach ]
end
ruby_block "test" do
block do
# prints [:find_snapshot_id, :ec2, :instance_id, :instance_availability_zone]
Chef::Log.info("Opscode::Aws::Ec2.instance_methods(false) #{Opscode::Aws::Ec2.instance_methods(false)}")
# This throws "undefined method `ec2' for Opscode::Aws::Ec2:Module"
Chef::Log.info("ec2: #{Opscode::Aws::Ec2.ec2}")
# This throws undefined local variable or method `new_resource' for #<Object:0x0000000293b0a0>