Skip to content

Instantly share code, notes, and snippets.

View carlossg's full-sized avatar
🦄
Yak shaving

Carlos Sanchez carlossg

🦄
Yak shaving
View GitHub Profile
@carlossg
carlossg / Dockerfile
Created December 17, 2014 19:19
ansible maven
FROM ansible/centos7-ansible:stable
# or, for example, FROM ansible/ubuntu14.04-ansible:stable
RUN yum install -y tar
RUN ansible-galaxy install geerlingguy.java
RUN ansible-galaxy install https://github.com/silpion/ansible-maven.git
# Add playbooks to the Docker image
COPY site.yml /
$ ./cluster/kubecfg.sh list pods
Name Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
$ ./cluster/kubecfg.sh list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
jenkins csanchez/jenkins-swarm:1.565.3 10.245.2.3/10.245.2.3 name=jenkins Running
2efdcb34-5096-11e4-8260-0800279696e1 csanchez/jenkins-swarm-slave:1.20 10.245.2.2/10.245.2.2 name=jenkins-slave,replicationController=jenkins-slave Running
$ vagrant suspend
==> master: Saving VM state and suspending execution...
==> minion-1: Saving VM state and suspending execution...
==> minion-2: Saving VM state and suspending execution...
#!/bin/sh
# kill it all!!!
#docker ps | awk '{print $1}' | grep -v CONTAINER | xargs docker kill
docker rm $(docker ps -a -q)
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
@carlossg
carlossg / jruby-json.rb
Last active February 16, 2023 15:27
JRuby json conversion
# test conversion of Java objects to json in JRuby
# jrjackson is the only gem doing it right, the others quote the result
# the trick for the other ones is to convert maps and lists to ruby hashes and arrays before
array = java.util.ArrayList.new().to_array
list = java.util.ArrayList.new()
map = java.util.HashMap.new()
nested = { :list => list }
require 'jrjackson'
@carlossg
carlossg / videbcontrol.sh
Created January 23, 2014 13:10
Script to change .deb control file and repackage
#!/bin/bash
# Change .deb control file and repackage
# credits Loevborg http://ubuntuforums.org/showthread.php?t=636724&p=3925729#post3925729
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
Parse.Cloud.define("hello", function(request, response) {
var xivelyKey = 'YOUR XIVELY KEY';
var feedId = 713578059;
var device = request.params.D;
var channels = {
31: 'Temperature',
30: 'Humidity'
};
var channel = channels[device];
@carlossg
carlossg / onx_wifi_post.js
Last active December 25, 2015 14:08
on{X} rule for POSTing to a url while connected to a specific wifi access point
// Initializing variables
// url to post to. If using ninjablocks this is a webhook you created in the dashboard
var url = "https://api.ninja.is/rest/v0/device/WEBHOOK_0_0_108/subdevice/fIOAY/tickle/xxxxxxxxxxx";
// the wifi SSID
var ssid = "myhomewifi";
// how often to trigger the POST
var seconds = 5*60;
var method = "POST";
@carlossg
carlossg / StubTest.java
Created May 13, 2012 19:08
Test the jclouds stub
Iterable<Module> modules = ImmutableSet.<Module> of( new SshjSshClientModule() );
ContextBuilder builder = ContextBuilder.newBuilder( "stub" ).credentials( "x", "y" ).modules( modules );
builder.buildView( ComputeServiceContext.class ).getComputeService();
com.google.inject.CreationException: Guice creation errors:
1) A binding to org.jclouds.predicates.SocketOpen was already configured at org.jclouds.sshj.config.SshjSshClientModule.configure(SshjSshClientModule.java:48).
at org.jclouds.compute.stub.config.StubComputeServiceDependenciesModule.socketOpen(StubComputeServiceDependenciesModule.java:116)
class test1(
$servicex = "sonar",
$logfoldera = "${homex}/logs",
$logfoldere = "${homey}/logs",
$logfolderh = "${homez}/logs",
$logfolder = "${homex}/logs",
$homex = "/var/${servicex}",
$homey = "/var/${servicex}",
$homez = "/var/${servicex}") {