Skip to content

Instantly share code, notes, and snippets.

import sys
import hashlib
import codecs
import hmac
from random import SystemRandom
_sys_rng = SystemRandom()
SALT_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
DEFAULT_PBKDF2_ITERATIONS = 150000
PY2 = sys.version_info[0] == 2
stage("Publish to Artifactory") {
// create a Artifactory server reference with some credentials we stored in Jenkins already
def server = Artifactory.newServer url: 'http://artifactory.example.com/artifactory', credentialsId: 'artifactory-credentials'
// Upload spec is a definition for the Artifactory plugin to tell it how and what to upload, and where in Artifactory it should go
def uploadSpec = """{
"files": [
{
"pattern": "binaries/*",
"target": "generic-local/golang/${applicationName}/",
"flat": false
#!/usr/bin/env groovy
// this will start an executor on a Jenkins agent with the docker label
node('docker') {
// Setup variables
// application name will be used in a few places so create a variable and use string interpolation to use it where needed
String applicationName = "basic-app"
// a basic build number so that when we build and push to Artifactory we will not overwrite our previous builds
String buildNumber = "0.1.${env.BUILD_NUMBER}"
// Path we will mount the project to for the Docker container
#!/usr/bin/env groovy
// this will start an executor on a Jenkins agent with the docker label
node('docker') {
// Setup variables
// application name will be used in a few places so create a variable and use string interpolation to use it where needed
String applicationName = "basic-app"
// a basic build number so that when we build and push to Artifactory we will not overwrite our previous builds
String buildNumber = "0.1.${env.BUILD_NUMBER}"
// Path we will mount the project to for the Docker container
package main
// Import the fmt for formatting strings
// Import os so we can read environment variables from the system
import (
"fmt"
"os"
)
// create a function named getUserName that returns a single string
package com.reynn.dailyprogrammer.Easy;
import java.io.*;
import java.util.Properties;
import java.util.Scanner;
/**
* create a program which is password protected, and wont open unless the correct
* user and password is given.
* For extra credit, have the user and password in a seperate .txt file.
import string
morseAlphabet = { # Messy Dictionary
".-" : 'A', "-..." : 'B', "-.-.": 'C', "-..": 'D',
".": 'E', "..-.": 'F', "--.": 'G', "....": 'H',
"..": 'I', ".---": 'J', "-.-": 'K', ".-..": 'L',
"--": 'M', "-.": 'N', "---": 'O', ".--.": 'P',
"--.-": 'Q', ".-.": 'R', "...": 'S', "-": 'T',
"..-": 'U', "...-": 'V', ".--": 'W', "-..-": 'X',
"-.--": 'Y', "--..": 'Z',
}
package com.reynn.dailyprogrammer.Easy;
import com.sun.javafx.css.CssError;
import sun.misc.Regexp;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;