Skip to content

Instantly share code, notes, and snippets.

@squarepegsys
squarepegsys / mvn2gradle.py
Created July 5, 2018 17:58
Convert maven deps to gradle format
#!/usr/bin/env python
import xml.etree.ElementTree as ET
ns = {'pom': "http://maven.apache.org/POM/4.0.0" , }
def find_exclusions(exclusions):
@nachivpn
nachivpn / unzip.ps1
Created February 25, 2016 05:01
Unzip a file in powershell by overwriting existing files
function Unzip($zipfile, $outdir)
{
Add-Type -AssemblyName System.IO.Compression.FileSystem
$archive = [System.IO.Compression.ZipFile]::OpenRead($zipfile)
foreach ($entry in $archive.Entries)
{
$entryTargetFilePath = [System.IO.Path]::Combine($outdir, $entry.FullName)
$entryDir = [System.IO.Path]::GetDirectoryName($entryTargetFilePath)
#Ensure the directory of the archive entry exists
@chinshr
chinshr / Jenkinsfile
Last active May 20, 2025 13:10
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@dannguyen
dannguyen / face-boxer-usage.md
Last active July 29, 2023 22:05
A face-detection script in Python

This face-boxer.py script is more-or-less the same code that you'll find in the OpenCV tutorial: Face Detection using Haar Cascades. For another variation, with more explanation, check out RealPython's tutorial.

Usage

The face-boxer.py script is designed to be run from the command-line. It has two required arugments:

  1. The path to a XML file containing a Haar-cascade of visual features. In this example, it will be the features that make up a face.
  2. The path to an image file that you want to perform face-detection on. You can pass in more than one image file as space-separated arguments.
@Lenbok
Lenbok / gist:7bfaf2ba590c05acfef3
Created July 8, 2014 22:59
Traffic-light / tinderbox style indicator columns in jenkins build history table
// Requires the groovy postbuild plugin. Supports several types of checkers
// Set debug to true if running in the jenkins groovy script console for testing, and update job name in the getJob call
// Set debug to false when added as groovy postbuild action
def debug = false
def job = debug ? Jenkins.getInstance().getJob("genopipe") : null
def build = debug ? job.getLastBuild() : manager.build
build.actions.each { action ->
if (debug) {
println(action.class.simpleName)
@savvot
savvot / ffmpeg-extract-keyframes.sh
Last active February 3, 2022 06:40
Extract only keyframes (I-frames) from video to images with console ffmpeg
ffmpeg -ss <start_time> -i video.mp4 -t <duration> -q:v 2 -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync 0 frame%03d.jpg
/*
* The plugins used for this build.
*/
/*
* Provides the compile, test, jar, etc tasks
*/
apply plugin: 'java'
/*
* Generates the Eclipse project files.
@francoisledroff
francoisledroff / francois.email.groovy.template
Created April 29, 2013 16:03
A groovy template to send fancy html formatted emails through the jenkins email extension plugins. the associated email extension plugin is https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin One way to debug it is to use a groovy script through the jenkins script menu (http://localhost:8080/jenkins/script) cf. https://gist.github.com/f…
<!DOCTYPE html>
<head>
<title>Build report</title>
<style type="text/css">
body
{
margin: 0px;
padding: 15px;
}
@francoisledroff
francoisledroff / debug-jenkins-email-ext-plugins.groovy
Created April 29, 2013 15:57
a groovy script to test your email extension templates cf. https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin to do that just * replace the projectName and p.recipientList values in the script below * run this script through http://localhost:8080/jenkins/script ** copy and paste it ** click "run"
import hudson.model.StreamBuildListener
import hudson.plugins.emailext.ExtendedEmailPublisher
import java.io.ByteArrayOutputStream
def projectName = "your-project-name-here"
Jenkins.instance.copy(Jenkins.instance.getItem(projectName), "$projectName-Testing");
def project = Jenkins.instance.getItem(projectName)
try {
def testing = Jenkins.instance.getItem("$projectName-Testing")