Skip to content

Instantly share code, notes, and snippets.

View vrivellino's full-sized avatar

Vincent Rivellino vrivellino

  • Charlottesville, VA
View GitHub Profile
@vrivellino
vrivellino / install-ubuntu.sh
Last active February 2, 2021 13:37
Install Ubuntu 18.04: ZFS on encrypted drives with USB boot disk
#!/usr/bin/env bash
# Adapted from https://github.com/zfsonlinux/zfs/wiki/Ubuntu-18.04-Root-on-ZFS
# Should be executed from a live CD environment
set -e
## CONFIG VARS
set -x
# Disk drive ids (symlinks in /dev/disk/by-id)
bootdisk='usb-SanDisk_Cruzer_AAAAAAAAAAAAAAAAAAAA-0:0'
rdisk1='ata-SanDisk_SDSSDHII120G_AAAAAAAAAAAA'
@vrivellino
vrivellino / ec2_cloud.groovy
Last active January 20, 2022 11:11
Jenkins EC2 Plugin Configuration via Groovy
/*
* Configure the Jenkins EC2 Plugin via Groovy Script
* EC2 Plugin URL: https://wiki.jenkins-ci.org/display/JENKINS/Amazon+EC2+Plugin
*/
import hudson.model.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.InstanceType
@vrivellino
vrivellino / ensure-cloudtrail.py
Created July 2, 2015 13:31
Ensure CloudTrail is activated in all regions
#!/usr/bin/env python
# tested with boto 2.38.0
import boto
import boto.cloudtrail
import json
import logging
import re
@vrivellino
vrivellino / ProcessKinesisRecords.js
Last active December 30, 2017 15:35
Lambda: archive kinesis stream to S3
console.log('Loading function');
var AWS = require('aws-sdk'),
s3 = new AWS.S3(),
s3Bucket = 'archive-bucket',
s3Prefix = 'kinesis-archive-test',
s3Partitions = 2;
exports.handler = function (event, context) {
//console.log(JSON.stringify(event, null, 2));
@vrivellino
vrivellino / trap-test.sh
Created March 18, 2015 19:46
bash trap test
#!/bin/bash
trap "echo SIGNAL 1" 1
trap "echo SIGNAL SIGHUP" SIGHUP
trap "echo SIGNAL 2" 2
trap "echo SIGNAL SIGINT" SIGINT
trap "echo SIGNAL 3" 3
trap "echo SIGNAL SIGQUIT" SIGQUIT
trap "echo SIGNAL 4" 4
trap "echo SIGNAL SIGILL" SIGILL
@vrivellino
vrivellino / add_to_bash_profile.sh
Last active August 29, 2015 14:14
Persistent ssh-agent on remove box
# setup ssh-agent
agent_env_file=~/.ssh/agent.env
agent_sock=~/.ssh/agent.sock
if [ -f $agent_env_file ] ; then
. $agent_env_file > /dev/null
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
echo "Stale agent file found. Spawning new agent ..."
eval `ssh-agent -t 4h -a $agent_sock | tee $agent_env_file`
ssh-add
fi