Skip to content

Instantly share code, notes, and snippets.

@rezamt
rezamt / logging_demo.py
Created June 22, 2019 12:29
Python Helper Notes
# replace all print with logging module
import logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(asctime)s: %(message)s')
logging.info('Sample logging')
logging.error('Sample logging')
logging.critical('Sample logging')
@rezamt
rezamt / docker-repository-setup.sh
Created June 9, 2019 13:58
Setting up Docker Remote Repository
# On Docker Repo Server - Run docker.io/repository:latest (docker version)
mkdir -p /docker_data/images # Docker images
mkdir -p /docker_data/certs # Repository SSL Certificate
# Get the hostname fqdn
hostname -f
# creating selfsign certificate
cd /docker_data/certs
@rezamt
rezamt / yumupdate.sh
Created June 6, 2019 23:04
Yum Repo Update
# Getting list of available updates
yum updateinfo list
# Only security patches
yum updateinfo list security all
# Update only security patches
yum -y update --security
# Update for sepcific CVE
@rezamt
rezamt / aws_s3_multipart_uploader.sh
Last active May 14, 2019 07:00
aws s3 multipart uploader (using jq and aws s3api command line api)
#!/bin/bash
BUCKET_NAME="soevm"
RAW_FILE_BASE="win2k-soe"
RAW_FILE="win2k-soe.raw"
UPLOAD_PAC="upload.json"
PARTS=7
# For example for Windows 2016 iso 6.5 GB ---> 7 * 1GB
for i in {1..$PARTS}; do dd if=$RAW_FILE of=$RAW_FILE_BASE-$i.raw bs=1024k skip=$[i*1024 - 1024] count=1024; done
@rezamt
rezamt / run-cordite.sh
Last active May 1, 2019 14:02
Running Cordite
# https://hub.docker.com/r/cordite/cordite/
docker run -it \
--memory=2048m \
--cpus=2 \
-e MY_LEGAL_NAME="O=Cordite-example,L=Berlin,C=DE" \
-e MY_PUBLIC_ADDRESS="cordite.example.com" \
-e MY_EMAIL_ADDRESS="[email protected]" \
-e NETWORK_MAP_URL="https://localhost" \
-v $(pwd):/opt/corda/certificates \
@rezamt
rezamt / HashFunction.java
Created April 29, 2019 14:17
HashFunction
private static class HashFunction {
private long prime;
private long odd;
public HashFunction(final long prime, final long odd) {
this.prime = prime;
this.odd = odd;
}
@rezamt
rezamt / jolokia-access.xml
Created April 22, 2019 11:57
jolokia-access.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Sample definitions for restricting the access to the Jolokia agent. Adapt this
file and copy it over to 'jolokia-access.xml', which get's evaluated during
runtime (if included in the war).
You can restrict the available methods in principale as well as the accessible
attributes and operations in detail.
-->
# Nexus
nexusArtifactUploader artifacts:
[[ artifactId: 'simple-maven-project-with-tests-1.0-${BUILD_NUMBER}',
classifier: 'JAR',
file: 'target/simple-maven-project-with-tests-1.0-SNAPSHOT.jar',
type: 'jar']],
credentialsId: 'nexus-admin',
groupId: 'inuit-repo-groups',
nexusUrl: 'localhost:8081/repository/cm2-ami-build/',
@rezamt
rezamt / gist:51e008e6caf60d77891b04564c59f47f
Created February 7, 2019 04:26
Jenkins Artifactory Pro - Pipeline Snip
rtUpload (
serverId: "Artifactory-1",
spec:
"""{
"files": [
{
"pattern": "target/*.jar",
"target": "my-repo/sub-folder/${BUILD_NUMBER}/"
},
{