This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import socket | |
from OpenSSL import crypto, SSL | |
# OpenVPN is fairly simple since it works on OpenSSL. The OpenVPN server contains | |
# a root certificate authority that can sign sub-certificates. The certificates | |
# have very little or no information on who they belong to besides a filename | |
# and any required information. Everything else is omitted or blank. | |
# The client certificate and private key are inserted into the .ovpn file | |
# which contains some settins as well and the entire thing is then ready for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Also available at: https://play.golang.org/p/yTTpB5gB6C | |
package main | |
import ( | |
"fmt" | |
) | |
// ***************************************************************************** | |
// Example 1 - Struct vs Struct with Embedded Type |
Try these rules:
(in www.domain.com's server block)
rewrite ^/$ http://domain.com permanent break;
rewrite ^/main(.*)$ http://domain.com$1 permanent break;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// More info on Getwd() | |
// https://golang.org/src/os/getwd.go | |
// | |
import( | |
"os" | |
"fmt" | |
"log" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The code below shows how to encrypt and then decrypt some plaintext into a cyphertext using | |
KMS's Encrypt/Decrypt functions and secretbox (https://godoc.org/golang.org/x/crypto/nacl/secretbox). | |
The plaintext message is sealed into a secretbox using a key that is generated by kmsClient.GenerateDataKey(). | |
Note that this procedure reuquires that a master key would *already exist in KMS* and that its arn/alias is specified. | |
The aws library assumes that the proper credentials can be found in the shared file (~/.aws/credentials) | |
and opts for the 'default' role. | |
Once sealed, the cyphertext is then unboxed, again by first getting the key from kms (kmsClient.Decrypt), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Allows to attach and remove EBS volumes managed under LVM to | |
# have a dynamically sized partition attached to an EC2 instance | |
# | |
# Intance needs either to be launched with a role able to access to relevant AWS API endpoints | |
# or the credentials can be hardcoded in the config. | |
# | |
# Minimal IAM Role: | |
# { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
import groovy.json.JsonOutput | |
import groovy.json.JsonSlurper | |
def label = "mypod-${UUID.randomUUID().toString()}" | |
podTemplate(label: label, yaml: """ | |
spec: | |
containers: | |
- name: mvn | |
image: maven:3.3.9-jdk-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
# Best of Jenkinsfile | |
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
node { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch. | |
# There are six variants that I have built: | |
# - pre-commit: stops commits to master/main/develop branches. | |
# - pre-commit-2: also includes a core.whitespace check. | |
# - pre-commit-3: the core.whitespace check and an EOF-newline-check. | |
# - pre-commit-4: only the core.whitespace check. | |
# - pre-commit-5: elixir formatting check. | |
# - pre-commit-6: prettier formatting check. | |
# Set the desired version like this before proceeding: |
NewerOlder