Skip to content

Instantly share code, notes, and snippets.

@saquibtmf
saquibtmf / store-plaintext-password.py
Last active February 2, 2024 14:52
updated the SVN store pass script to pass username as an argument rather than from stdin
#!/usr/bin/env python3
"""\
Script to store password in plaintext in ~/.subversion/auth/svn.simple/
Useful in case Subversion is compiled without support for writing
passwords in plaintext.
Only use this script if the security implications are understood
and it is acceptable by your organization to store passwords in plaintext.
@saquibtmf
saquibtmf / nginxproxy.md
Created March 8, 2023 09:50 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@saquibtmf
saquibtmf / jenkinsParsingForGithubPayload
Created March 8, 2023 09:47 — forked from jimCresswell/jenkinsParsingForGithubPayload
Jenkins script in Groovy to parse a Github web hook payload for the commit that triggered the pull request that triggered the service hook ... and then set that as a build variable that can be used in further Jenkins scripts or parameterised jobs. See http://chloky.com/github-pull-req-webhook/ and https://gist.github.com/bjhess/2726012 for setti…
import hudson.model.*
def payloadString = build.buildVariableResolver.resolve("payload")
payloadObject = new groovy.json.JsonSlurper().parseText(payloadString)
targetCommit = payloadObject.pull_request.head.sha
build.addAction(new ParametersAction(new StringParameterValue('targetCommit', targetCommit)))
@saquibtmf
saquibtmf / checkjobs.groovy
Created January 13, 2023 10:19 — forked from paul-butcher/checkjobs.groovy
Jenkins pipeline to check the status of a set of other jobs
import groovy.json.JsonSlurper
def getJobStatus(String jobName){
def rx = httpRequest "https://jenkins.example.com/job/${jobName}/lastBuild/api/json"
def rxJson = new JsonSlurper().parseText(rx.getContent())
return rxJson['result']
}
node() {
def any_success = false
@saquibtmf
saquibtmf / print-jenkins-secret-file-contents.groovy
Created December 14, 2022 22:12 — forked from briceburg/print-jenkins-secret-file-contents.groovy
Print content of secret files from the Jenkins Credentials Store
import com.cloudbees.plugins.credentials.*;
import com.cloudbees.plugins.credentials.domains.Domain;
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl;
//
// modify fileName to match the filename of the secret(s) you want to print.
// (ID would probably be more helpful... yay stack overflow copy pasta)
// alternatively comment out the filter [line 15] to dump all secret files.
//
def fileName = "secrets.env"
@saquibtmf
saquibtmf / nexus-uploader.py
Created December 8, 2022 08:10 — forked from omnisis/nexus-uploader.py
Uploads a local M2 repo to a remote Nexus Server
#!/usr/bin/env python
""""
nexus-uploader.py
Allows mirroring local M2 repositories to a remote Nexus server with a single command.
Supports:
- uploading of common classifiers (sources, javadocs) if available
- using regex include pattern for artifactIds/groupIds
- recursively processing local repo, just point to the root
@saquibtmf
saquibtmf / ObjAllProperties.groovy
Last active December 6, 2022 12:18 — forked from HopefulLlama/properties.groovy
Print all properties of a Groovy object
println object.properties
.sort{it.key}
.collect{it}
.findAll{!['class', 'active'].contains(it.key)}
.join('\n')