Skip to content

Instantly share code, notes, and snippets.

View flozano's full-sized avatar

Francisco A. Lozano flozano

  • Kii corporation
  • Valencia, Spain
View GitHub Profile
@lordkev
lordkev / ec2_enc.rb
Created October 13, 2011 20:43
Puppet EC2 Security Group ENC
#!/usr/bin/ruby
##
# Classifies a puppet node based on its EC2 security group.
# Requires the AWS gem.
# Also requires a node_groups.yml file which specifies security groups
# and the classes/params that should be applied, in the following
# format (additionally keyed by security group name).
# http://docs.puppetlabs.com/guides/external_nodes.html
#
@milligramme
milligramme / bash_completion
Created January 20, 2012 08:13
brew install bash-completion
$ brew install bash-completion
==> Downloading http://bash-completion.alioth.debian.org/files/bash-completion-1.3.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/bash-completion/1.3
==> make install
==> Caveats
Add the following lines to your ~/.bash_profile file:
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@mgwilliams
mgwilliams / hiera.py
Created February 22, 2012 22:07
Python script to access data from hiera...
from subprocess import check_output
import json
import collections
def hiera(key, environment, location, hostname, merge=None, preserve_order=True, bin="/usr/local/bin/hiera", confdir="/etc/puppet/"):
if preserve_order:
obj_pair_hook=collections.OrderedDict
else:
obj_pair_hook=None
@UnquietCode
UnquietCode / MockSQS.java
Last active October 1, 2022 04:00
Mock AWS SQS implementation which operatesin-memory rather than hitting the real SQS.
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.ResponseMetadata;
import com.amazonaws.regions.Region;
import com.amazonaws.services.sqs.AmazonSQS;
import com.amazonaws.services.sqs.model.*;
import com.google.common.hash.Hashing;
import java.util.*;
@JakeWharton
JakeWharton / README.md
Created June 12, 2014 15:38
Map Java 8 streams to RxJava Observables.

Output

Greeting: Hey
Greeting: Hi
Greeting: Hello

[60, 61, 62, 63, 64, 65, 66, 67, 68, 69]
[70, 71, 72, 73, 74, 75, 76, 77, 78, 79]
[80, 81, 82, 83, 84, 85, 86, 87, 88, 89]
@crowcoder
crowcoder / Invoice
Created September 4, 2014 23:39
CSS/HTML only report sample implemented as a simple Invoice
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Invoice</title>
<style media="screen">
body {
font-family: 'Segoe UI','Microsoft Sans Serif',sans-serif;
}
/*
@mosheeshel
mosheeshel / RabbitContainerRule.java
Created October 2, 2014 14:33
JUnit @rule for starting a RabbitMQ container (based on other rule - see comments)
package rules;
import com.google.common.collect.ImmutableMap;
import org.eclipse.jdt.launching.SocketUtil;
import java.util.HashMap;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
@JaiHirsch
JaiHirsch / Grades.java
Last active October 8, 2018 02:37
MongoDB 3.0 java driver Codec example - base class for the Codec mapping (bean)
/*
MongoDB bean object for java 3.0 driver mapping
*/
package org.scratch;
import org.bson.BsonDocument;
import org.bson.BsonDocumentWrapper;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.conversions.Bson;
@JaiHirsch
JaiHirsch / GradesCodec.java
Created March 29, 2015 16:51
MongoDB 3.0 java driver Codec example - Codec class for the mapping the Grades bean
package org.scratch;
import org.bson.BsonReader;
import org.bson.BsonString;
import org.bson.BsonValue;
import org.bson.BsonWriter;
import org.bson.Document;
import org.bson.codecs.Codec;
import org.bson.codecs.CollectibleCodec;
import org.bson.codecs.DecoderContext;
@JaiHirsch
JaiHirsch / GradeInserter.java
Created March 29, 2015 16:52
MongoDB 3.0 java driver Codec example - main class to run the Grades Codec example
package org.scratch;
import org.bson.Document;
import org.bson.codecs.Codec;
import org.bson.codecs.configuration.CodecRegistries;
import org.bson.codecs.configuration.CodecRegistry;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.client.MongoCollection;