Skip to content

Instantly share code, notes, and snippets.

@alexcasalboni
alexcasalboni / deploy.sh
Last active January 29, 2024 12:22
Simple AWS Lambda deployment script - Zip & upload Deployment Package with initial dependencies to S3
#!/bin/bash
BUCKET="YOUR_BUCKET_NAME" # bucket name
FILENAME="deployment-package.zip" # upload key
TMP_FOLDER="/tmp/lambda-env-tmp/" # will be cleaned
OUTPUT_FOLDER="/tmp/lambda-env/" # will be cleaned
HERE=${BASH_SOURCE%/*} # relative path to this file's folder
LAMBDA_FOLDER="$HERE/lambda/" # relative path
@yifan-gu
yifan-gu / test.md
Last active April 19, 2017 15:16
tls --experimental-bootstrap-kubeconfig
@ayapi
ayapi / refresh-viewport-height-demo.html
Last active July 19, 2022 10:34
minimum example xterm.js refresh-viewport-height
<!doctype html>
<html>
<head>
<title>xterm.js demo</title>
<link rel="stylesheet" href="../src/xterm.css" />
<script src="../src/xterm.js" ></script>
<script src="../addons/fit/fit.js" ></script>
<style>
#term-box {
overflow: hidden;
node {
// Mark the code checkout 'Checkout'....
stage 'Checkout'
// // Get some code from a GitHub repository
git url: '[email protected]:myorg/infrastructure.git'
// Get the Terraform tool.
def tfHome = tool name: 'Terraform', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
@klingerf
klingerf / openssl.cnf
Created May 13, 2016 01:47
Sample openssl config file
dir = certificates
[ ca ]
default_ca = CA_default
[ CA_default ]
serial = $dir/serial
database = $dir/index.txt
new_certs_dir = $dir/newcerts
certificate = $dir/cacert.pem
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active April 25, 2025 15:35
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
// Let jenkins know that you want to execute the commands on a dedicated jenkins slave
node('dockerSlave') {
def mvnHome = tool 'M3'
// Cleanup local checkout - TODO there should also be a dedicated jenkins command to invoke this action
sh "rm -rf *"
sh "rm -rf .git"
// Clone from git
checkout scm
// Checkout specific local branch
checkout([$class: 'GitSCM', branches: [[name: '*/master']],
@rudelm
rudelm / autofs.md
Last active May 15, 2025 18:50
Use autofs on Mac OS X to mount network shares automatically during access

Autofs on Mac OS X

With autofs you can easily mount network volumes upon first access to the folder where you want to mount the volume. Autofs is available for many OS and is preinstalled on Mac OS X so I show you how I mounted my iTunes library folder using this method.

Prepare autofs to use a separate configuration file

autofs needs to be configured so that it knows where to gets its configuration. Edit the file /etc/auto_master and add the last line:

#
# Automounter master map
#

+auto_master # Use directory service

@blinksmith
blinksmith / X509KeyPairtest.go
Created February 26, 2016 20:50
Golang crypto/tls.X509KeyPair function usage example
package main
import (
"fmt"
"os"
"crypto/tls"
"crypto/x509"
)
func main() {
var rsaCertPEM = [] byte(`-----BEGIN CERTIFICATE-----
MIICEzCCAXygAwIBAgIQMIMChMLGrR+QvmQvpwAU6zANBgkqhkiG9w0BAQsFADAS
@wellsie
wellsie / module_publish_to_aws_cloudwatch_logs.tf
Created January 18, 2016 06:36 — forked from conorgil/module_publish_to_aws_cloudwatch_logs.tf
Sharing IAM Role Policies between multiple IAM Roles
# AWS Cloudwatch Logs install documentation:
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/QuickStartEC2Instance.html
# By defining this IAM Role Policy in a module, it can be referenced anywhere it is required
# for an IAM Role. This is preferrable to copy/pasting the IAM Policy statement because changes
# made to this role will automatically apply to all IAM Roles referencing this module.
###
# Variables
###