Skip to content

Instantly share code, notes, and snippets.

🦄
Yak shaving

Carlos Sanchez carlossg

🦄
Yak shaving
Block or report user

Report or block carlossg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1250837
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}") {
@carlossg
carlossg / StubTest.java
Created May 13, 2012
Test the jclouds stub
View StubTest.java
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)
@carlossg
carlossg / onx_wifi_post.js
Last active Dec 25, 2015
on{X} rule for POSTing to a url while connected to a specific wifi access point
View onx_wifi_post.js
// 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";
View ninja-parse-xively.js
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 / videbcontrol.sh
Created Jan 23, 2014
Script to change .deb control file and repackage
View videbcontrol.sh
#!/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
@carlossg
carlossg / jruby-json.rb
Last active Aug 29, 2015
JRuby json conversion
View jruby-json.rb
# 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'
View docker-cleanup.sh
#!/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}')
View kubernetes-suspend
$ ./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...
View list pods
$ ./cluster/kubecfg.sh list pods
Name Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
View Dockerfile
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 /
You can’t perform that action at this time.