Skip to content

Instantly share code, notes, and snippets.

View arehmandev's full-sized avatar
🎯
Focusing

Abdul Rehman arehmandev

🎯
Focusing
  • Capgemini
  • London, UK
View GitHub Profile
@arehmandev
arehmandev / grapeconfig.xml
Last active February 12, 2018 16:20
One that actually works
<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
<settings defaultResolver="downloadGrapes" />
<resolvers>
<ibiblio name="ibiblio-maven2" m2compatible="true"/>
<ibiblio name="java-net-maven2" root="http://download.java.net/maven/2/" m2compatible="true" />
<ibiblio name="maven" root="http://mvnrepository.com/artifact/" m2compatible="true" />
<chain name="downloadGrapes">
<resolver ref="maven"/>
<resolver ref="ibiblio-maven2"/>
import hudson.model.*
def q = Jenkins.instance.queue
q.items.each {
if (it =~ /deploy-to/) {
q.cancel(it.task)
}
}
@arehmandev
arehmandev / clear_build_history.groovy
Last active July 8, 2019 14:00 — forked from realityforge/Delete historic hobs and some workspaces
Kill all queued jenkins jobs and cancel any running jobs
Jenkins.instance.getView('All').getBuilds().each { it.delete() }
@arehmandev
arehmandev / .drone.yml
Created January 28, 2018 12:09 — forked from d0x2f/.drone.yml
.drone.yml example
workspace:
base: /build
pipeline:
build-image:
image: docker
commands:
# Build development target, which includes xdebug.
# Tag with both api-build:<build_number> and api-build:latest.
@arehmandev
arehmandev / groovy.json
Last active August 9, 2022 19:59
VSCode Jenkins groovy snippets
{
/*
//Please click VSCode -> Preferences -> User Snippets -> groovy
//Then copy and paste this into groovy.json
*/
/*
// Place your snippets for Groovy here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
@arehmandev
arehmandev / insertlogrotate.sh
Last active November 30, 2017 12:02
Insert logrotate into all jenkins seed jobs with a nifty script
#!/bin/zsh
#### Uses the-silver-surfer (ag) and zsh
touch rotatelogdone.txt
ag -L logRotator --nocolor | xargs ls -1 > rotatelogdone.txt
ARRAY=($(cat rotatelogdone.txt))
for VAR in ${ARRAY[@]}
@arehmandev
arehmandev / vars.sh
Last active November 24, 2017 21:02
#!/bin/bash
( set -o posix ; set ) > vars
sed -i '/BASHOPTS/d' vars
sed -i '/BASH_VERSINFO/d' vars
sed -i '/EUID/d' vars
sed -i '/PPID/d' vars
sed -i '/SHELLOPTS/d' vars
sed -i '/UID/d' vars
@arehmandev
arehmandev / main.go
Created November 22, 2017 23:01
Golang - Concurrent for loop to increment 10 times using waitgroups
package main
import "fmt"
import "sync"
func main() {
var wg sync.WaitGroup
count := 10
wg.Add(count)
@arehmandev
arehmandev / forloops.groovy
Created November 7, 2017 21:13
Jenkinsfile groovy for loop behaviour
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
loop_of_sh(abcs)
}
stage('Test 3: loop with preceding SH') {
@arehmandev
arehmandev / kube_config.ctmpl
Last active October 28, 2017 03:04
kube config ctemplate
apiVersion: v1
kind: Config
clusters:
{{- if eq (env "KUBE_ENVIRONMENT") "pr-kops" "pr" }}
{{- with secret (printf "secret/jenkins/kubernetes/%s" (env "KUBE_ENVIRONMENT"))}}
- cluster:
api-version: v1
server: "{{ .Data.api }}"
{{- if .Data.token}}
insecure-skip-tls-verify: true