Skip to content

Instantly share code, notes, and snippets.

View tstrul1's full-sized avatar

Tzachi Strul tstrul1

View GitHub Profile
@tstrul1
tstrul1 / cheatsheet-elasticsearch.md
Created July 23, 2021 13:49 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
EMAILLOCALPART [a-zA-Z0-9!#$%&'*+\-/=?^_`{|}~]{1,64}(?:\.[a-zA-Z0-9!#$%&'*+\-/=?^_`{|}~]{1,62}){0,63}
EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
import hudson.model.*
for (aSlave in hudson.model.Hudson.instance.nodes) {
if (aSlave.name ==~ /.*<slave name>.*/) {
println('Shutting down node '+aSlave.name);
hudson.model.Hudson.instance.removeNode(aSlave);
}
}
@tstrul1
tstrul1 / ansible-module
Created September 30, 2020 15:40
custom ansible module
#!/usr/bin/python
# -*- coding: utf-8 -*-
from ansible.module_utils.basic import AnsibleModule
from zeep import Client as Client, Transport
import urllib3
import time
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@tstrul1
tstrul1 / Jenkins_creds
Created September 30, 2020 15:38
print jenkins secrets
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class
)
for (c in creds) {
println(c.id)
if (c.properties.username) {
println(" description: " + c.description)
}
if (c.properties.username) {
println(" username: " + c.username)
apiVersion: apps/v1
kind: Deployment
metadata:
name: greeter
spec:
selector:
matchLabels:
app.kubernetes.io/name: greeter
replicas: 1
template:
@tstrul1
tstrul1 / ingress.yaml
Created August 29, 2020 12:13 — forked from subudhiroshan/ingress.yaml
ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: iron-gallery-ingress
spec:
rules:
- host: iron-gallery-braavos.com
http:
paths:
- path: /
@tstrul1
tstrul1 / volume.yaml
Created August 29, 2020 12:09 — forked from matthewpalmer/volume.yaml
Kubernetes volume example YAML
kind: Pod
apiVersion: v1
metadata:
name: simple-volume-pod
spec:
# Volumes are declared by the pod. They share its lifecycle
# and are communal across containers.
volumes:
# Volumes have a name and configuration based on the type of volume.
# In this example, we use the emptyDir volume type
kind: Service
apiVersion: v1
metadata:
name: hostname-service
spec:
# Expose the service on a static port on each node
# so that we can access the service from outside the cluster
type: NodePort
# When the node receives a request on the static port (30163)
kind: Pod
apiVersion: v1
metadata:
name: pod-env-var
spec:
containers:
- name: env-var-configmap
image: nginx:1.7.9
envFrom:
- configMapRef: