Skip to content

Instantly share code, notes, and snippets.

View edwin-bluekite's full-sized avatar

Edwin Allen edwin-bluekite

  • Bluekite
  • Guatemala
View GitHub Profile
@edwin-bluekite
edwin-bluekite / params.pp
Created December 6, 2014 16:55
GW Role Params
$paths = [
{
'log_files' => ["${application_directory}/log/${application_environment}.log"],
'application' => "${application_name}",
'environment' => "${application_environment}",
'stack' => "${application_environment}${stack_id}",
'fqdn' => "${fqdn}",
'file' => "${application_environment}.log",
'type' => 'application',
},
@edwin-bluekite
edwin-bluekite / tmux.md
Last active August 29, 2015 14:07
Tmux Cheat Sheet

Copy & Paste

  • list-buffers | C-#
  • paste-buffer | C-]

Resize

  • h,j,k,l

Windows

  • c new window
  • w list windows
@edwin-bluekite
edwin-bluekite / index.js
Last active August 29, 2015 14:07
Simple hapi post server
var Hapi = require('hapi');
// Create a server with a host and port
var server = new Hapi.Server('localhost', 8000);
// Add the route
server.route({
method: 'POST',
path: '/notification',
handler: function (request, reply) {
@edwin-bluekite
edwin-bluekite / bucket.js
Created October 2, 2014 14:09
Mysql Numbers Module
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'adj',
database : 'xoomphones'
});
module.exports = {
@edwin-bluekite
edwin-bluekite / agent.nut
Created September 6, 2014 21:42
Electric Imp Led Switch Agent and Device
const COWBELL = "https://agent.electricimp.com/05V8cFjX6eN4";
function cowbell(nullData) {
server.log("Button action");
// http.get(COWBELL).sendsync();
}
device.on("buttonPress", cowbell);

Open viles

Browsing a directory

  • :e {route}

Navigation

  • $ principio de linea
  • 0 final de linia
  • w start of the next word
  • e end of the word
  • b beginig of word
$ sudo /usr/bin/sqlite3 /opt/nagios/var/rw/nagios_hosts.db 'create table add_hosts (hostname TEXT, dstamp INTEGER); create table del_hosts (hostname TEXT);'
$ sudo /opt/xoom/nagios/bin/process_api_hosts_icinga.sh add
$ vim /opt/nagios/etc/check_mk/conf.d/hosts.mk #check if is correct
$ sudo service monitoring start
@edwin-bluekite
edwin-bluekite / sse.js
Last active August 29, 2015 14:01
Nipple post and get
// 1. I'm doing a post request to a resource
// 2. I read SSE url for the creation procces of the resource is readed in the link header of the response
// 3. I run a GET to that url an try to stream the SSE to stdout
var parse = require('parse-link-header');
var Nipple = require('nipple');
Nipple.post('resourceurl.com/myresource',{payload:somedata}, function (err1, res1, payload1) {
Nipple.read(res1, function (err1, body) {
@edwin-bluekite
edwin-bluekite / storepagination.coffee
Last active August 29, 2015 13:59
Pagination Over EmberJS Store
Ember.FEATURES['ember-routing-drop-deprecated-action-style'] = true
App = Ember.Application.create({})
App.IndexController = Ember.ArrayController.extend(
page: 5
perPage: 10
start: (->
page = @get("page")
perPage = @get("perPage")
(page - 1) * perPage
).property("page", "perPage")
@edwin-bluekite
edwin-bluekite / validation.js
Created February 18, 2014 18:07
Hapi Joi field validation
//Route
{
method: 'GET',
path: '/{version}/services/{path*}',
config:{
handler: {
proxy: {
mapUri: controller.payments.mapper ,
passThrough: true,