| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //npm install b64url | |
| //A signed_request for testing: | |
| //WGvK-mUKB_Utg0l8gSPvf6smzacp46977pTtcRx0puE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyOTI4MjEyMDAsImlzc3VlZF9hdCI6MTI5MjgxNDgyMCwib2F1dGhfdG9rZW4iOiIxNTI1NDk2ODQ3NzczMDJ8Mi5ZV2NxV2k2T0k0U0h4Y2JwTWJRaDdBX18uMzYwMC4xMjkyODIxMjAwLTcyMTU5OTQ3NnxQaDRmb2t6S1IyamozQWlxVldqNXp2cTBmeFEiLCJ1c2VyIjp7ImxvY2FsZSI6ImVuX0dCIiwiY291bnRyeSI6ImF1In0sInVzZXJfaWQiOiI3MjE1OTk0NzYifQ | |
| function parse_signed_request(signed_request, secret) { | |
| encoded_data = signed_request.split('.',2); | |
| // decode the data | |
| sig = encoded_data[0]; | |
| json = base64url.decode(encoded_data[1]); | |
| data = JSON.parse(json); // ERROR Occurs Here! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var base64ToString = function(str) { | |
| return (new Buffer(str || "", "base64")).toString("ascii"); | |
| }; | |
| var base64UrlToString = function(str) { | |
| return base64ToString( base64UrlToBase64(str) ); | |
| }; | |
| var base64UrlToBase64 = function(str) { | |
| var paddingNeeded = (4- (str.length%4)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put on the server | |
| # put in /etc/puppet/custom/plugins/facter/custom_facts.rb | |
| require 'yaml' | |
| if File.exist?("/etc/puppet/custom_facts.yml") | |
| YAML.load_file("/etc/puppet/custom_facts.yml").each do |key, value| | |
| Facter.add(key.to_sym) do | |
| setcode { value } | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cookbooks/chef_notifier/libraries/chef_notifier.rb | |
| # | |
| # This monkeypatches Chef::Runner to report the result of run_action calls via MCollective | |
| require 'mcollective' | |
| class MRPC | |
| include MCollective::RPC | |
| def report_action(resource, action) | |
| options = MCollective::Util.default_options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cfengine | |
| declarative | |
| runs continuously | |
| language is "baroque" | |
| supports classes | |
| large number of action sequences | |
| ----- | |
| puppet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app = node[:rails][:app] | |
| rails_base app[:name] do | |
| ruby_ver app[:ruby_ver] | |
| gemset app[:gemset] | |
| end | |
| %w{config log pids cached-copy bundle system}.each do |dir| | |
| directory "#{app[:app_root]}/shared/#{dir}" do | |
| owner app[:deploy_user] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name "base5" | |
| description "Contains run list of roles which are safe to run on all RHEL5 and RHEL6 servers." | |
| override_attributes "inittab" => { | |
| "runlevel" => "3" | |
| }, | |
| "chef_client" => { | |
| "server_url" => "http://chef.example.com:4000", | |
| "init_style" => "init" | |
| }, | |
| "logwatch" => { |
- CloudStack is all about allocating a pool of resources out to customers/clients but we don't have a pool of assets (racks of machines) when developing. Luckily there is a pre-configured VirtualBox VM all setup to pretend to be available to CloudStack for just such testing/development purposes.
- Follow these instructions: http://wiki.cloudstack.org/display/COMM/DevCloud
- I work out of
~/eng, so thecloudstackgit repo is there, but it's scripted to live elsewhere, so...mkdir -p /opt/cloudstack(might have to sudo, chmod etc.)ln -s /Users/gburd/eng/cloudstack /opt/cloudstack/incubator-cloudstack
- We'll need the cloudstack-python-client later, install that...
git clone git://github.com/jasonhancock/cloudstack-python-client.gitcd cloudstack-python-clientpip install .
- A few
antcommands will need additional jars in your Ant library path, so do that...
Changes:
-
this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .
ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.
-
this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.
This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.
OlderNewer