Skip to content

Instantly share code, notes, and snippets.

View jespada's full-sized avatar

jespada jespada

View GitHub Profile
@marciopaiva
marciopaiva / centos7_ambiente_desenvolvimento.md
Last active April 1, 2022 18:05
CentOS 7 - Apache 2.4 + MOD_PROXY_FCGI + PHP-FPM 5.5 + InstantClient Oracle.

CentOS 7 - Apache 2.4 + PHP-FPM 5.5 + InstantClient Oracle.


Montando uma VM para o desenvolvimento de aplicações em PHP, utilizado o CentOS 7

@manuel-rubio
manuel-rubio / README.md
Last active February 1, 2016 03:02
IM Binary & SSL protocol think for use with mobile platforms. This protocol has special approach on small & slow data transfers and security.

IM Binary & SSL secured

All the time I was working with XMPP I realized this protocol has a lot of flaws to use in mobile devices, even the lack of sync for the messages between several devices. This protocol tries to solve those flaws:

  1. Use of bandwidth. This protocol is binary and use keywords to save a lof of bandwidth using the same protocol and the same featureas as XMPP.
  2. Reliability of the messages. Using ACKs in every sent ensure all of the messages will arrive to the destin and in the same order. The protocol is async, but for messages the server must to use a pipeline sent.
  3. Multi-device. Capabilities to ensure the messages are delivered on all the devices the user has registered.
  4. Security. Ensuring a certificate is valid between client and server (client must to check server certificate and server must to check client certificate) ensure the communication should be more secure.

REGISTER, AUTH & SESSIONS

@kachayev
kachayev / concurrency-in-go.md
Last active September 23, 2025 16:12
Channels Are Not Enough or Why Pipelining Is Not That Easy
@john2x
john2x / 00_destructuring.md
Last active August 18, 2026 13:46
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@obazoud
obazoud / oneshot.rb
Last active August 29, 2015 14:04
Chef: How to remove a recipe dynamically ?
ruby_block 'remove_dynamically_oneshot' do
block { node.run_list.remove('recipe[mycookbook::oneshot]') }
end

Why?

The chef-zero or "local-mode" of chef-client should be used to apply a cookbook to the server that you run it on without involving a full blown Chef Server of any kind. It does this by firing up a mini chef server that requires zero configuration in the background and uploding your cookbooks to it and doing a real chef-client converge against it, completely transparently. This allows you to use all the features of Chef without the need to think about running a server.

Other Options

There is also the chef-solo utility that is similar, but is limited in that it cannot talk to a chef server at all, and therefore features like search are architecturally broken. Ideally, it should not be used for new development work.

The chef-apply utility that can be used to converge resources in a single file against a host without a server and without any cookbook structure at all. Since there is no available structure other than the recipe file features like search, data bags, templates and other res

ChefDK, Test Kitchen Driven NTP Cookbook

This gist uses TK+Berkshelf to drive creating a vagrant virts and converging a simple recipe to install and configure NTPd. This is a simple cookbook that has one recipe, one template (for ntp.conf) and one attribute file. It works on Ubuntu 12.04 and CentOS 6.4 (and derviatives) and the attribute file is used to support both distros.

This should work on Mac (where I developed it) and any chef-supported Linux that you can get Vagrant onto (Ubuntu/CentOS).

Because I use ChefDK and Test Kitchen, I can largely ignore setting up Vagrant and Berkshelf and can get right to work on writing recipe code.

NOTE: Modern (7/6/2014) Recipe Generation

my application cookbooks define attribute like this which define node data in the node['sk_services'] namespace which is designed to be searchable by other nodes and give information (in this case information that an nginx proxy needs to know).

% cat attributes/default.rb
default['sk_services']['www.visibility-project.com']['normal_port'] = 80
default['sk_services']['www.visibility-project.com']['ssl_port'] = 443
default['sk_services']['www.visibility-project.com']['listen_port'] = 8080
default['sk_services']['www.visibility-project.com']['cache_dirs'] = [
  'assets',
]

To use a knife plugin programmatically, from any ruby script, you need first know the source of the plugin. you have to know the config options for all the command line arguments you are interested to use. All knife plugin use mixlib-cli interface, and the command line options can be found at the beginning of the file (convention), declared using option method. if you are curious take a look at mixlib-cli readme

1.require the corresponding plugin file

require '/path/to/plugin'
deploy_cookbook ()
{
EXPECTED_ARGS=2;
BAD_ARGS_ERROR_CODE=65;
if [ $# -ne $EXPECTED_ARGS ]; then
echo 'Usage: deploy_cookbook ${ENV} ${COOKBOOK}';
return $BAD_ARGS_ERROR_CODE;
fi;
environment=$1;
cookbook=$2;