Skip to content

Instantly share code, notes, and snippets.

View judavi's full-sized avatar

Juan judavi

  • Palet Town
View GitHub Profile
@judavi
judavi / Readme.md
Last active August 22, 2019 12:50
Download CVE notes from Grafeas API in Google Container registry

This is an script to download CVE notes from Grafeas. Could be really handy if you need to populate your Grafeas instance with some initial information

@judavi
judavi / fillGrafeas.sh
Last active August 16, 2019 13:25
Grafeas Insert Test Data
docker run -e POSTGRES_PASSWORD=password -e POSTGRES_USER=postgres -p 5432:5432 -d postgres
curl -X POST "http://localhost:8080/v1beta1/projects" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"name\": \"projects/user\"}"
curl -X POST "http://localhost:8080/v1beta1/projects/user/notes?note_id=commonrfq" -H "accept: application/json" -H "Content-Type: application/json" -d @note.json
curl -X POST "http://localhost:8080/v1beta1/projects/user/occurrences" -H "accept: application/json" -H "Content-Type: application/json" -d @ocurrence.json
@judavi
judavi / commands.sh
Last active August 12, 2019 19:36
Jenkins EKS
kubectl exec -it my-app-c456bf7c5-tl6cf -- cat /var/jenkins_home/secrets/initialAdminPassword
docker run jenkins/jnlp-slave -url http://jenkins-server:port <secret> <agent name>
kubectl run my-app --image=jenkins/jenkins:lts --port=8080 --port=50000
@judavi
judavi / filebeat.yml
Created July 18, 2019 15:00
All lines filebeat
harvester_buffer_size: 66384
multiline.pattern: 'Started by user '
multiline.negate: true
multiline.match: after
multiline.max_lines: 255000
multiline.timeout: 250s
multiline.flush_pattern: 'Finished: '
@judavi
judavi / script.sh
Created June 28, 2019 22:24
Change creation date of all files in directory MacOS
for f in *; do t=$(echo $f | sed -E 's/[-. mov]//g'); touch -mt 201906211300 $f; done
#for f in *; do t=$(echo $f | sed -E 's/[-. mov]//g'); touch -mt YYYYMMDDHHMM $f; done
@judavi
judavi / groovy.groovy
Created April 10, 2019 10:31
Jenkins Start new node/agent container and send emails
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, cloud: 'myKubernetesCluster',
containers:[
containerTemplate(name: 'jnlp',
alwaysPullImage: true,
resourceRequestMemory: '4Gi',
resourceLimitMemory: '4Gi',
resourceRequestCpu: '1000m', resourceLimitCpu: '1000m',
workingDir: '/home/jenkins/workspace',
@judavi
judavi / Readme.md
Created April 7, 2019 10:09
Install Docker-ce CentOS or RHEL

#Install Docker & Docker Compose - Centos 7

Step 1 — Install Docker Install needed packages:

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Configure the docker-ce repo:

@judavi
judavi / gist:2f2289596f34d3cc87be21a2be082875
Created February 22, 2019 07:51
Add sink cards on Linux
https://unix.stackexchange.com/questions/174379/how-can-i-create-a-virtual-output-in-pulseaudio
You can add a sink with
pacmd load-module module-null-sink sink_name=MySink
pacmd update-sink-proplist MySink device.description=MySink
You can add a loopback device with the command
pacmd load-module module-loopback sink=MySink
@judavi
judavi / log.log
Last active February 22, 2019 06:40
log
Preparing to unpack .../linux-sound-base_1.0.25+dfsg-0ubuntu5_all.deb ...
Unpacking linux-sound-base (1.0.25+dfsg-0ubuntu5) ...
Selecting previously unselected package alsa-base.
Preparing to unpack .../alsa-base_1.0.25+dfsg-0ubuntu5_all.deb ...
Unpacking alsa-base (1.0.25+dfsg-0ubuntu5) ...
Selecting previously unselected package alsa-utils.
Preparing to unpack .../alsa-utils_1.1.3-1ubuntu1_amd64.deb ...
Unpacking alsa-utils (1.1.3-1ubuntu1) ...
Selecting previously unselected package alsa-tools.
Preparing to unpack .../alsa-tools_1.1.3-1_amd64.deb ...
@judavi
judavi / Readme.md
Last active February 2, 2019 11:46
Docker Linux ACL

The idea of use the native permissions from Linux on the containers will work, because when the container is running it acts as a normal Linux machine, respecting the user/groups permissions.

Using the next Dockerfile as an example

# I'm using the ubuntu image only for testing porpouse, the same will apply for RHEL
FROM ubuntu

# Switch to root