Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcel Araujo marcelaraujo

  • EDP
  • Portugal - Lisboa
View GitHub Profile
@marcelaraujo
marcelaraujo / macos-port-forward.sh
Created Nov 30, 2020 — forked from gregjhogan/macos-port-forward.sh
local port forwarding on macOS
View macos-port-forward.sh
#!/bin/bash
ifconfig lo0 alias 127.0.1.1
ifconfig lo0 alias 127.0.10.1
# clear rules
pfctl -F all -f /etc/pf.conf
# set rules
echo "
@marcelaraujo
marcelaraujo / macos-port-forward.sh
Created Nov 30, 2020 — forked from gregjhogan/macos-port-forward.sh
local port forwarding on macOS
View macos-port-forward.sh
#!/bin/bash
ifconfig lo0 alias 127.0.1.1
ifconfig lo0 alias 127.0.10.1
# clear rules
pfctl -F all -f /etc/pf.conf
# set rules
echo "
@marcelaraujo
marcelaraujo / kill_all.groovy
Last active Oct 21, 2020 — forked from steven-terrana/kill_all.groovy
[Kill All Builds] kill all queued and running jobs #Jenkins
View kill_all.groovy
import java.util.ArrayList
import hudson.model.*;
// Remove everything which is currently queued
def q = Jenkins.instance.queue
for (queued in Jenkins.instance.queue.items) {
q.cancel(queued.task)
}
// stop all the currently running jobs
@marcelaraujo
marcelaraujo / README.md
Last active Sep 10, 2020
Convert P12 to PEM and extract RSA public and private keys
View README.md

Convert P12 into PEM

openssl pkcs12 -in google-service-account-key.p12 -nocerts -nodes -out google-service-account-key.pem

openssl pkcs12 -in google-service-account-key.p12 -clcerts -nokeys -out google-service-account-crt.pem

Private RSA key

openssl rsa -in google-service-account-key.pem -out google-service-account-key-rsa

Public RSA key

openssl rsa -in google-service-account-key.pem -out google-service-account-key-rsa.pub -pubout

View a_openssl_playground.md

OpenSSL Playground

Verify downloaded file
➜  openssl dgst -sha256 openssl-1.1.1.tar.gz
SHA256(openssl-1.1.1.tar.gz)= 2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
➜  cat openssl-1.1.1.tar.gz.sha256
2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
RSA Public Key pad and encrypt
View jenkins-update-users-password.groovy
import hudson.model.User
import jenkins.model.Jenkins
import hudson.security.HudsonPrivateSecurityRealm
import hudson.security.HudsonPrivateSecurityRealm.Details
def instance = Jenkins.getInstance()
def realm = instance.getSecurityRealm()
def users = realm.getAllUsers()
def generator = { int n ->
View jenkins-list-credentials.groovy
import com.cloudbees.plugins.credentials.CredentialsNameProvider
import com.cloudbees.plugins.credentials.Credentials
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey
import org.jenkinsci.plugins.plaincredentials.StringCredentials
import org.jenkinsci.plugins.plaincredentials.FileCredentials
String checksum( String input ) {
View Dockerfile
FROM php:7.3-alpine
# This image is ready to build projects using technologies:
# - PHP7 (with Lumen)
# - Angular v8
# Check stack details in: https://confluence.agile.corp.edp.pt/display/TNG/PHP7
ENV COMPOSER_VERSION=1.9.3 \
COMPOSER_CACHE_DIR=/tmp/.composer/cache \
View gencert.sh
#!/bin/bash
mkdir -p ssl
cat << EOF > ssl/req.cnf
[req]
req_extensions = v3_req
distinguished_name = req_distinguished_name
[req_distinguished_name]
[ v3_req ]
You can’t perform that action at this time.