Skip to content

Instantly share code, notes, and snippets.

@leogsilva
leogsilva / x5tS256.sh
Created February 22, 2022 20:53
Jwt x5t#S256 thumbprint confirmation method
cat >example.crt<<EOF
-----BEGIN CERTIFICATE-----
MIIDPDCCAiQCCQDfkemtGUyxAjANBgkqhkiG9w0BAQsFADBgMQswCQYDVQQGEwJK
UDEOMAwGA1UECAwFVG9reW8xEzARBgNVBAcMCkNoaXlvZGEta3UxDzANBgNVBAoM
BkNsaWVudDEbMBkGA1UEAwwSY2xpZW50LmV4YW1wbGUub3JnMB4XDTIwMDUxMTEx
MDcyM1oXDTIxMDUxMTExMDcyM1owYDELMAkGA1UEBhMCSlAxDjAMBgNVBAgMBVRv
a3lvMRMwEQYDVQQHDApDaGl5b2RhLWt1MQ8wDQYDVQQKDAZDbGllbnQxGzAZBgNV
BAMMEmNsaWVudC5leGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAMu7V2QyQk4iLPry0OsykR/8WO2aNOBNoVZYDexF1TsFv9s2S4PEDFEt
1BZrEmBe5HWpGb1iuDGG6wjAanEkea8AIUgslMsOOB0rQnbJA3nI5wktjCG2VzWo
@leogsilva
leogsilva / deviceflow.go
Created February 20, 2022 21:20
device flow & auth0 with cognito identity and credentials verification
// https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-the-device-authorization-flow#example-request-token-post-to-token-url
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
use std::collections::HashMap;
pub struct Professor{}
pub struct Student{}
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ProfessorId(u32);
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@leogsilva
leogsilva / default.conf.template
Created August 5, 2020 21:29
nginx configuration template file for simple reverse proxy server
upstream demo2.localhost {
server ${UPSTREAM};
}
server {
#ssl_certificate /etc/nginx/certs/demo.pem;
#ssl_certificate_key /etc/nginx/certs/demo.key;
@leogsilva
leogsilva / Jenkins-plugin-dev.sh
Created July 10, 2018 19:20
docker development environment for jenkins plugins
docker run -d --rm --name pause -p 8080:8080 -p 8000:8000 -p 9090:80 -p 8181:8181 dockermonster/pause-amd64:3.0
docker run -d \
--net=container:pause --ipc=container:pause --pid=container:pause \
--env JENKINS_OPTS=--httpPort=8181 \
--env JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n jenkins/jenkins:lts
docker run -d \
--net=container:pause --ipc=container:pause --pid=container:pause \
@leogsilva
leogsilva / ecs-jenkins-swarm-task-definition.json
Last active July 28, 2017 19:27
Simple ECS Task Definition for connecting windows 2016 host to jenkins master using swarm plugin. You should update the jenkins master address and password according to your environment
{
"containerDefinitions": [{
"name": "jenkins-swarm",
"cpu": 100,
"essential": true,
"image": "microsoft/windowsservercore",
"memory": 500,
"entryPoint": [
"powershell",
"-Command"
@leogsilva
leogsilva / TestClient.java
Created November 17, 2016 00:22
Example of AUTH0 and Api Gateway client
package br.com.tiequity;
import java.util.Map;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSSessionCredentials;
import com.amazonaws.internal.StaticCredentialsProvider;
import com.amazonaws.mobileconnectors.apigateway.ApiClientFactory;
import com.auth0.Auth0;
@leogsilva
leogsilva / Vagrantfile
Created June 7, 2016 14:20
Vagrant file for bosh-lite and bare metal installation
abort("No SERVER_IP specified, cannot continue") unless ENV["SERVER_IP"]
abort("No SSH_KEY specified, cannot continue") unless ENV["SSH_KEY"]
Vagrant.configure('2') do |config|
config.vm.box = 'cloudfoundry/bosh-lite'
config.vm.provider :virtualbox do |v, override|
override.vm.box_version = '9000.126.0' # ci:replace
# To use a different IP address for the bosh-lite director, uncomment this line:
# override.vm.network :private_network, ip: '192.168.59.4', id: :local
@leogsilva
leogsilva / terraform.py
Created April 25, 2016 14:26
How to discover ip from hosts inside terraform.tfstate. Execute terraform.py --hostfile | more in the directory containing the tfstate file. Code by cisco
#!/usr/bin/env python
#
# Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
{"keys": [
{
"kty": "RSA",
"use": "SIGNATURE",
"alg": "RS256",
"kid": "01407925-b7c0-45ec-93cd-aa5379a86347",
"exp": null,
"crv": null,
"privateKey": {
"n": "hWwigOuUYe40h82_NAweOwEhme4wPnsfo8axV5qp03pWUFQdP1NY9DkRQvKzuWzczxFjlZPXqqc8_hzR7NemHPrbz_JO4i7eF2aEtSolhXvhq0uyO9fsZdXuIhjfuCFSs-PZ3utT-t7zn__IfUDr7QEo_5hSm12nvrCuCZQPURU_Io6PVVZQSjUoryVPRyj7K0J0JaTlqmKvAtBsSzWLi5dBcPDyVFV4hX-bCrpvBDfVlbV6SvcGp40OFboKS-jj09k4vLBM9JanIfa7H1ISb6eoAwS-hMJdt4AHMMKKX_ASKq_mUGJyfHwie57oU0Ep16myuz_P4c5iPsNIkQRjZw",