Skip to content

Instantly share code, notes, and snippets.

@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}/"
},
{
@rezamt
rezamt / gist:ddbb1158e6d7b0858dda9b3d460e2db1
Created February 2, 2019 09:23
Query AWS EC2 instances
# aws ec2 describe-volumes --query 'Volumes[*].{Id:VolumeId,Size:Size,Type:VolumeType}'
# aws ec2 describe-instances --query Reservations[*].Instances[*].InstanceId --output text
# Ref: https://www.youtube.com/watch?v=nPLV7lGbmT4
@rezamt
rezamt / umount_disks.sh
Created January 28, 2019 00:42
umount and clean file system
#!/bin/bash
cp /etc/fstab /etc/fstb.original
FDISKLIST=`fdisk -l|grep "Disk /dev/xvd"|awk '{print $2}'|awk -F: '{print $1}'|grep -v /dev/xvda`
for DISK in `echo $FDISKLIST`
do
DISKNAME=`echo $DISK|awk -F/ '{print $3}'`
umount -f $DISK1 || /bin/true
Packer v1.3.2
Your version of Packer is out of date! The latest version
is 1.3.3. You can update by downloading from www.packer.io/downloads.html
windows git:(master) ✗ packer build -var "disk_size=61440" -var "password=$password" windows.json
2018/12/18 23:47:56 [INFO] Packer version: 1.3.2
2018/12/18 23:47:56 Packer Target OS/Arch: darwin amd64
2018/12/18 23:47:56 Built with Go Version: go1.11.1
2018/12/18 23:47:56 Detected home directory from env var: /Users/reza
2018/12/18 23:47:56 Using internal plugin for alicloud-ecs
2018/12/18 23:47:56 Using internal plugin for qemu
2018/12/18 23:47:56 Using internal plugin for scaleway
2018/12/18 23:47:56 Using internal plugin for openstack
2018/12/18 23:47:56 Using internal plugin for docker
# How
qemu-img create -f raw -o size=20G w2k2016dc_disk.img
qemu-system-x86_64 -boot d -cdrom /Users/reza/Downloads/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO -m 2048M -hda /Users/reza/projects/w2k2016dc_disk.img
# References
# https://pastebin.com/VfRRr5KV
# https://www.emaculation.com/doku.php/ppc-osx-on-qemu-for-osx