Skip to content

Instantly share code, notes, and snippets.

Avatar

Vincent Rivellino vrivellino

  • Charlottesville, VA
View GitHub Profile
@vrivellino
vrivellino / install-ubuntu.sh
Last active Feb 2, 2021
Install Ubuntu 18.04: ZFS on encrypted drives with USB boot disk
View install-ubuntu.sh
#!/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 Jan 20, 2022
Jenkins EC2 Plugin Configuration via Groovy
View ec2_cloud.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 Jul 2, 2015
Ensure CloudTrail is activated in all regions
View ensure-cloudtrail.py
#!/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 Dec 30, 2017
Lambda: archive kinesis stream to S3
View ProcessKinesisRecords.js
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));
View trap-test.sh
#!/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 Aug 29, 2015
Persistent ssh-agent on remove box
View add_to_bash_profile.sh
# 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