Skip to content

Instantly share code, notes, and snippets.

View nehaljwani's full-sized avatar

Nehal J Wani nehaljwani

View GitHub Profile
@nehaljwani
nehaljwani / compile_houdini.sh
Created September 18, 2017 06:48
Compile houdini standalone binary
builder@concourse32:/tmp$ wget https://storage.googleapis.com/golang/go1.9.linux-386.tar.gz
builder@concourse32:/tmp$ tar -xf go1.9.linux-386.tar.gz
builder@concourse32:/tmp$ export GOROOT=$PWD/go
builder@concourse32:/tmp$ git clone --recursive https://github.com/vito/houdini
builder@concourse32:/tmp$ cd houdini
builder@concourse32:/tmp/houdini$ export GOPATH=$PWD/deps
builder@concourse32:/tmp/houdini$ mkdir deps/src/github.com/vito/
builder@concourse32:/tmp/houdini$ ln -s $PWD deps/src/github.com/vito/houdini
builder@concourse32:/tmp/houdini$ $GOROOT/bin/go build -o dist/houdini ./cmd/houdini
builder@concourse32:/tmp/houdini$ cd dist/
@nehaljwani
nehaljwani / purge-build-queue.groovy
Created August 24, 2017 10:29
Jenkins Purge Build Queue By Job Name
import hudson.model.*
def q = Jenkins.instance.queue
q.items.findAll { it.task.name.endsWith('-poc') }.each { q.cancel(it.task) }
@nehaljwani
nehaljwani / openconnect_vpn_inside_netns.sh
Created July 30, 2017 09:43
OpenConnect VPN Inside Linux Network Namespace
#!/bin/bash
# start openconnect tunnel and shell inside Linux network namespace
#
# this is a fork of schnouki's script, see original blog post
# https://schnouki.net/posts/2014/12/12/openvpn-for-a-single-application-on-linux/
#
# original script can be found here
# https://gist.github.com/Schnouki/fd171bcb2d8c556e8fdf
# ------------ adjust values below ------------
@nehaljwani
nehaljwani / get_buildable_jobs_jenkins.groovy
Created June 8, 2017 12:12
Jenkins System Groovy: Get enabled jobs
import hudson.model.*
count = 0
Hudson.instance.items.each {
if(it.buildable && it.name.endsWith("-gerrit")) {
count++
}
}
println count
@nehaljwani
nehaljwani / no-so-hidden-host-info.txt
Created April 29, 2017 16:15
Partitioning Layout contained.af
/ # find /sys/devices/pci0000\:00/0000\:00\:03.0/virtio0/host0/target0\:0\:1/ | grep -e uevent -e stat | xargs strings
active
DEVTYPE=scsi_target
unsupported
MAJOR=251
MINOR=0
DEVNAME=bsg/0:0:1:0
unsupported
8446 0 406160 443755 1117647 621363 125793800 116845711 0 1122736 117288827
unsupported
@nehaljwani
nehaljwani / run_command_on_slave.groovy
Created March 29, 2017 14:53
Jenkins System Groovy Run Remote Command on Slave
import hudson.util.RemotingDiagnostics;
print_ip = 'println InetAddress.localHost.hostAddress';
print_hostname = 'println InetAddress.localHost.canonicalHostName';
// here it is - the shell command, uname as example
uname = 'def proc = "uname -a".execute(); proc.waitFor(); println proc.in.text';
for (slave in hudson.model.Hudson.instance.slaves) {
if (slave.name == 'kube2-el6-196755b25b94e') {
@nehaljwani
nehaljwani / apache_conf_redicrection_before_ldap_auth.conf
Last active March 21, 2017 10:14
Sample Apache Conf with Redirection Before Auth
<VirtualHost *:46342 *:46343>
ServerName conda.mycompany.com
ServerAlias conda
AddIcon /icons/tar.gif .tar.bz2
AddIcon /icons/compressed.gif .bz2
AddIcon /icons/index.gif .json
DocumentRoot /path/to/conda-channels
@nehaljwani
nehaljwani / iterate_over_publishers.groovy
Created March 14, 2017 14:19
Iterate over Publishers System Groovy Jenkins
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /myjob.*/
}
matchedJobs.each {
for (publisher in it.publishersList) {
if (publisher instanceof org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder) {
println publisher.script.script
}
}
@nehaljwani
nehaljwani / get_parameters_of_builds.groovy
Created March 14, 2017 11:02
Get Specific Build Parameter of all builds
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /.*/
}
matchedJobs.each {
allBuilds = it.getBuilds()
jobName = it.fullName
allBuilds.each {
println jobName + ' ' + it.buildVariableResolver.resolve("GERRIT_REFSPEC")
}
@nehaljwani
nehaljwani / php_ping_transfer_encoding_chunked.php
Created March 14, 2017 09:58
PHP Script with Transfer Encoding: Chunked
<?php
header("Transfer-encoding: chunked");
function dump_chunk($chunk) {
printf("%x\r\n%s\r\n", strlen($chunk), $chunk);
flush();
}
ob_implicit_flush(true);
ob_end_flush();