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
@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 gist:2d5cb66f1048d41063e7
Jan 28, 2015 11:35:29 AM hudson.model.DownloadService$Downloadable doPostBack
SEVERE: <div class=error><img src='/jenkins/static/69e42646/images/none.gif' height=16 width=1>Signature verification failed in downloadable &#039;hudson.tools.JDKInstaller&#039; <a href='#' class='showDetails'>(show details)</a><pre style='display:none'>java.security.cert.CertPathValidatorException: timestamp check failed
at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:129)
at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:212)
at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:140)
at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:79)
at java.security.cert.CertPathValidator.validate(CertPathValidator.java:292)
at org.jvnet.hudson.crypto.CertificateUtil.validatePath(CertificateUtil.java:93)
at jenkins.util.JSONSignatureValidator.verifySignat
View gist:23fa67f3749593878594
### Keybase proof
I hereby claim:
* I am carlossg on github.
* I am carlos (https://keybase.io/carlos) on keybase.
* I have a public key whose fingerprint is 03C6 E9F3 C99E 43AC D46F 4202 4EBC 0C9F 0208 FC11
To claim this, I am signing this object:
@carlossg
carlossg / 1.7.0 rc2
Last active Aug 29, 2015
Docker shared mount
View 1.7.0 rc2
$ sudo umount /mnt/xvdb
$ cat /proc/self/mountinfo | grep mnt
67 22 202:1 /mnt /mnt rw,relatime shared:1 - ext4 /dev/disk/by-uuid/e1d70192-1bb0-461d-b89f-b054e45bfa00 rw,discard,data=ordered
$ docker --version
Docker version 1.7.0-rc2, build 7ddecf7
$ docker run -d --name test -v /mnt/xvdb:/mnt busybox tail -f /dev/null
9865a125bd2d43cb06887e821e1b298fdee944bb72604edb2f5862619c1a200a
$ ls -laF /mnt/xvdb
total 8
drwxr-xr-x 2 root root 4096 Jun 17 20:05 ./
@carlossg
carlossg / dhcp-monitor
Created Jul 10, 2015
DHCP monitor and reload
View dhcp-monitor
#!/bin/sh
HOSTS="8.8.8.8"
COUNT=1
while true
do
for myHost in $HOSTS; do
if ! ping -c $COUNT $myHost > /dev/null; then
echo "Host : $myHost is down (ping failed) at $(date)"
@carlossg
carlossg / readme.md
Created Sep 17, 2015
Mesos SSL problems
View readme.md

Configuration

In /etc/default/mesos

export SSL_ENABLED=true
export SSL_SUPPORT_DOWNGRADE=false
export SSL_REQUIRE_CERT=true
export SSL_CERT_FILE=/etc/mesos/tiger-jdoe-controller-1.tiger.acme.net.crt
export SSL_KEY_FILE=/etc/mesos/tiger-jdoe-controller-1.tiger.acme.net.key
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}") {
You can’t perform that action at this time.