Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
useradd -s /bin/bash -m unprivileged
cp -rf ~/.ssh ~unprivileged/
chown -R unprivileged:unprivileged ~unprivileged/.ssh/
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API
@imranansari
imranansari / convert-svn-to-git.sh
Created March 21, 2018 20:03 — forked from aheritier/convert-svn-to-git.sh
Script used at eXo to convert various SVN projects to Git. You can reuse some of its content but you won' be able to run it with others eXo SWF scripts.
#!/bin/bash -eu
# Load SWF functions
source /home/swfcommons/bin/swfcommons-functions.sh
# Initialize our script
swf_init_script $0
swf_init_var
# Get config (use this for environment specific settings)
swf_load_env
@imranansari
imranansari / data_Dockerfile
Created February 1, 2018 17:19 — forked from twasink/data_Dockerfile
Dockerfile for a Jenkins data volume container
# Needs to match the linux version used in jenkins-master
FROM debian:jessie
MAINTAINER Robert Watkins
# user 1000 must match the user id for the jenkins user in jenkins-master
RUN useradd -d "/var/jenkins_home" -u 1000 -m -s /bin/bash jenkins
RUN mkdir -p /var/log/jenkins
RUN chown -R jenkins:jenkins /var/log/jenkins
@ivan-pinatti
ivan-pinatti / jenkins-add-ssh-keypair-with-password-credential.groovy
Last active June 21, 2023 11:46
Jenkins - Add SSH keypair with password credential via groovy script - #jenkins #groovy #ssh #credential
#!groovy
// imports
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.Domain
import com.cloudbees.plugins.credentials.impl.*
import hudson.util.Secret
import java.nio.file.Files
@rtyler
rtyler / find-ed25519.groovy
Last active October 12, 2018 18:35
Determine whether there are passphrase-protected ed25519 keys in a Jenkins instance
import com.cloudbees.hudson.plugins.folder.*
import com.cloudbees.hudson.plugins.folder.properties.*
import com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider.FolderCredentialsProperty
import com.cloudbees.plugins.credentials.*
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey
/* Let's see if the key is ed25518 */
boolean checkKey(def key) {
boolean found = false
@imranansari
imranansari / README.md
Created August 22, 2017 19:50 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.

Turning Off Github Issues

My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...

Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they

#!groovy
node {
// Need to replace the '%2F' used by Jenkins to deal with / in the path (e.g. story/...)
// because tests that do getResource will escape the % again, and the test files can't be found
ws("workspace/${env.JOB_NAME}/${env.BRANCH_NAME}".replace('%2F', '_')) {
// Mark the code checkout 'stage'....
stage 'Checkout'
checkout scm
// Mark the code build 'stage'....
@imranansari
imranansari / Server.groovy
Created June 13, 2016 16:42 — forked from harniman/Server.groovy
A Jenkins Workflow shared library class to perform a Form Based authentication to a Jenkins Server and retrieve the body from a URL.
package net.harniman.workflow.jenkins
//import org.apache.commons.httpclient.*
//import org.apache.commons.httpclient.auth.*
import org.apache.commons.httpclient.Header
import org.apache.commons.httpclient.HostConfiguration
import org.apache.commons.httpclient.HttpClient
import org.apache.commons.httpclient.NameValuePair
import org.apache.commons.httpclient.methods.GetMethod