Skip to content

Instantly share code, notes, and snippets.

View mcastilho's full-sized avatar

Marcio Castilho mcastilho

View GitHub Profile
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client();
var eventPattern = /([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) \"(.*?)\" \"(.*?)\" \"(.*?)\" \"(.*?)\" \"(.*?)\"/;
exports.handler = function(data, context) {
var events = [];
var encodedEvent, rawEvent,
matchedEvent, event, i,
commands;
#!/bin/bash
# Check out the blog post at:
#
# http://www.philipotoole.com/influxdb-and-grafana-howto
#
# for full details on how to use this script.
AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
INFLUXDB_DATABASE=test1
//
// MNDocumentController.h
// MindNodeTouch
//
// Created by Markus Müller on 22.12.08.
// Copyright 2008 Markus Müller. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MNDocumentReference;
@tarom
tarom / 03-sidekiq.config
Last active July 14, 2017 23:05
Elastic Beanstalk appdeploy/post hook script for Sidekiq
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@boriscy
boriscy / incomes_controller.rb
Last active October 14, 2017 08:05
Print to PDF using phantomjs
# Example controller
class IncomesController < ApplicationController
# Include the print
include Controllers::Print
# GET /incomes/1
def show
@income = present Income.find(params[:id])
respond_to do |format|
//
// MNDocumentConflictResolutionViewController.h
// MindNodeTouch
//
// Created by Markus Müller on 15.12.11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MNDocumentReference;
@boctor
boctor / BaseViewController.m
Created May 5, 2011 02:08
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights

USER AUTHENTICATION

password_digest

  • rails pre/append 'salt' before running through a hash algorithm
Digest::SHA1.digest("abcd1234")
"|\xE05\x9F\x12\x85\x7F*\x90\xC7\xDEF_@\xA9_\x01\xCB]\xA9"
2.2.3 :007 >
  • start by creating a user model
@danro
danro / .gvimrc
Created July 25, 2011 22:55
The macvim config continues to grow!
" What a funny comment character
" .gvimrc.local
" Remember to set the following in vimrc:
" let g:snips_trigger_key='<c-space>' " Custom snipmate trigger
" let mapleader="," " Change the leader
" let g:loaded_matchparen=1 " Disable matchparen highlight
" start macvim config
if has("gui_macvim")
@miyamoto-daisuke
miyamoto-daisuke / vpc-knowhow-2014-04.template
Last active October 20, 2020 07:02
VPC knownhow 2014-04
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "VPC knowhow template",
"Parameters": {
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type": "String",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern": "[-_ a-zA-Z0-9]*",