Skip to content

Instantly share code, notes, and snippets.

@bonyiii
bonyiii / gist:9531930
Created March 13, 2014 16:35
berlin clock
# TODO
# tömbként tároljuk az lámpa sorokat
# lámp sorok tömbe tartalmazzák a state -ket
# másodperc alapján eldöntjük az első sort
# óra / 5 kidja a második sorban színes lámpák számát annyi indexet felkapcsolunk
# óra mod 5 vissza adja a harmadik sor szines lámpák számát
# perc / 5 negyedik sor minden 3 piros
# pert mod 5
#
class BerlinClock
class MyApp.CarsController extends Batman.ApplicationController
# Appears to work the same way MyApp.CarsIndexView#viewDidAppear
@afterAction only: "index", ->
$('table').dataTable()
index: (params) ->
@set('cars', MyApp.Car.get('all'))
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@bonyiii
bonyiii / facebook_graph_api.rb
Last active August 29, 2015 14:26 — forked from zosiu/facebook_graph_api.rb
Facebook Graph API w/ Koala
### app access token
graph = Koala::Facebook::OAuth.new APP_ID, APP_SECRET
graph.get_app_access_token # => APP_TOKEN
### create test users with permissions
test_users = Koala::Facebook::TestUsers.new app_id: APP_ID, secret: APP_SECRET
user = test_users.create true, 'email,user_birthday,user_posts', name: 'Bob'
# =>
# { "id" => USER_ID,
# "access_token" => USER_ACCESS_TOKEN,
Given /^I want to see where I am$/ do
tmp = Tempfile.new 'culerity_results'
tmp << $browser.html
tmp.close
`konqueror #{tmp.path}`
end
If one wants to call MSSQL statements like this
declare @aha as varchar(4000);
set @aha='SELECT * FROM pubs.dbo.titles;';
exec(@aha)
One have to use prepare/execute combo:
statement = dbconn.prepare( sql )
results = statement.execute # vagy statement.run
Point is to prepare before execute
require 'culerity'
Before do
$rails_server ||= Culerity::run_rails
sleep 5
$server ||= Culerity::run_server
$browser = Culerity::RemoteBrowserProxy.new $server, {:browser => :firefox3#,
#:resynchronize => true,
#:javascript_exceptions=>true,
#:refresh_handler=> :waiting,
bear-chef certificates # ls -la /etc/chef/
total 28
drwxr-xr-x 4 chef chef 4096 Apr 17 19:28 .
drwxr-xr-x 46 root root 4096 Apr 17 19:17 ..
-rw-r--r-- 1 root root 0 Mar 26 15:51 .keep_app-admin_chef-0
-rw-r--r-- 1 chef chef 0 Apr 17 18:56 .keep_app-admin_chef-server-0
-rw-r--r-- 1 chef chef 0 Mar 26 16:53 .keep_app-admin_chef-solr-0
drwx------ 2 chef chef 4096 Apr 17 19:35 certificates
drwxr-xr-x 8 root root 4096 Apr 1 14:46 chef-repo
-rw-r--r-- 1 chef chef 496 Mar 26 15:51 client.rb
bear-chef chef # egrep -v '^\s*(#|$)' /etc/chef/server.rb
log_level :debug
log_location '/var/log/chef/server.log'
ssl_verify_mode :verify_none
chef_server_url 'http://localhost:4000'
signing_ca_path '/var/lib/chef/ca'
signing_ca_cert '/var/lib/chef/ca/cert.pem'
signing_ca_key '/var/lib/chef/ca/key.pem'
couchdb_database 'chef'
cookbook_path [ '/var/lib/chef/cookbooks', '/var/lib/chef/site-cookbooks' ]
# Chef telepítés.
# Itt lehet infókat találni arról, hogy kell telepíteni chef -et.
# Először ezt csináljuk végig.
#http://github.com/veszig/chef-overlay
#http://wiki.opscode.com/pages/viewpage.action?pageId=1180116
#http://github.com/opscode/chef-repo
###
# Szever