Skip to content

Instantly share code, notes, and snippets.

@stefanmaric
stefanmaric / copy-to-clipboard-bookmarklet.md
Created September 7, 2016 20:54
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
@alecharp
alecharp / keep-jenkins-plugins-uptodate.groovy
Last active March 20, 2025 20:02
Simple groovy script to upgrade active plugins when new versions are available
jenkins.model.Jenkins.getInstance().getUpdateCenter().getSites().each { site ->
site.updateDirectlyNow(hudson.model.DownloadService.signatureCheck)
}
hudson.model.DownloadService.Downloadable.all().each { downloadable ->
downloadable.updateNow();
}
def plugins = jenkins.model.Jenkins.instance.pluginManager.activePlugins.findAll {
it -> it.hasUpdate()
@ivan-pinatti
ivan-pinatti / jenkins-create-job-scm-flow.groovy
Last active February 17, 2022 07:46
Jenkins - Create a Jenkins job via groovy script that; cleans before checkout, shallow clone, sparse checkout only the Jenkinsfile and set lightweight - #jenkins #groovy #jenkins-job #jenkins-git #git #jenkinsfile
#!groovy
// imports
import hudson.plugins.git.*
import hudson.plugins.git.extensions.*
import hudson.plugins.git.extensions.impl.*
import jenkins.model.Jenkins
// parameters
def jobParameters = [