Skip to content

Instantly share code, notes, and snippets.

@rajsahae
rajsahae / gist:e0cbd7b88e9221eb99e7adaa0586e67d
Last active May 9, 2018 — forked from rb2k/gist:8372402
A jenkins script to clean up workspaces on slaves
View gist:e0cbd7b88e9221eb99e7adaa0586e67d
// Check if a slave has < 2 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
import org.jenkinsci.plugins.workflow.job.WorkflowRun
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
View sanitized output grepped for failure
> /usr/bin/git rev-parse refs/remotes/origin/track-down-failure^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/track-down-failure^{commit} # timeout=10
Checking out Revision cc75f3064d22c486fd9eea79ad58f3310e78cb07 (refs/remotes/origin/track-down-failure)
> /usr/bin/git rev-parse refs/remotes/origin/track-down-failure^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/track-down-failure^{commit} # timeout=10
Checking out Revision cc75f3064d22c486fd9eea79ad58f3310e78cb07 (refs/remotes/origin/track-down-failure)
/usr/bin/install -c -m 644 [... omitted ...]
# XFAIL: 0
# FAIL: 0
# ERROR: 0
View jenkinsfile
#!groovy
def jobs = [
tag_1 : { sh 'scripts/diagnostics.sh arg11 arg12 arg13' },
tag_2 : { sh 'scripts/diagnostics.sh arg21 arg22 arg23' },
tag_3 : { sh 'scripts/diagnostics.sh arg31 arg32 arg33' },
]
timestamps {
View basic file input stdout output logstash conf
input {
file {
path => ["/Users/rsahae/Downloads/8501-stdout.txt"]
}
}
output {
#elasticsearch { embedded => true }
stdout { codec => rubydebug }
}
@rajsahae
rajsahae / gist:6631781
Created Sep 20, 2013
Finding empty directiories in bash
View gist:6631781
for dir in `find . -type d | tail -n +2`; do
[ "`find $dir -type f | wc -l`" -eq "0" ] && echo "$dir is empty"
done
@rajsahae
rajsahae / gist:6257806
Created Aug 17, 2013
Errors I get using Treetop to parse
View gist:6257806
irb(main):002:0> Parser.parse "123"
RuntimeError: Parse error at offset: 0
from /Users/rsahae/dev/badaal/lib/badaal/parser.rb:27:in `parse'
from (irb):2
from /Users/rsahae/.rvm/rubies/ruby-1.9.3-p327/bin/irb:18:in `<main>'
irb(main):003:0> Parser.parse "123.123"
=> FloatLiteral+Float2 offset=0, "123.123":
SyntaxNode offset=0, ""
SyntaxNode offset=0, "123":
SyntaxNode offset=0, "1"
@rajsahae
rajsahae / gist:6125788
Created Jul 31, 2013
make failure when installing ruby-1.9.3-p448 with rvm on debian wheezy system
View gist:6125788
rsahae@rsahae-test:~$ cat ~/.rvm/log/ruby-1.9.3-p448/1375233743_make.log
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -I. -I.ext/include/i686-linux -I./include -I.
DLDFLAGS = -Wl,-soname,libruby.so.1.9
SOLIBS = -lpthread -lrt -ldl -lcrypt -lm
linking miniruby
View gist:5953616
require 'rookie'
namespace :test do
desc "description of some test"
task :some_test do
dir = File.expand_path(__FILE__)
rspec_command = "rspec --no-color --format documentation --out"
outpath = "#{dir}/test-results.#{Time.now.strftime("%Y.%m.%d")}.txt"
filepath = "spec/test/*"
You can’t perform that action at this time.