Skip to content

Instantly share code, notes, and snippets.

View antillean's full-sized avatar

Kamal antillean

View GitHub Profile
@antillean
antillean / Vagrantfile
Last active September 3, 2016 15:31
A Vagrantfile I put in the root of my Windows workspace to make a nice Linux dev env for Java things
# -*- mode: ruby -*-
# vi: set ft=ruby :
# https://docs.vagrantup.com.
Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "boxcutter/ubuntu1604"
# config.vm.synced_folder ".", "/vagrant"
## curls a url every second to see if it's up. Returns the response code, highlighting it if it changes.
watch -n1 -d curl -s -o /dev/null -w %{http_code} https://www.url.to.check
@antillean
antillean / README.md
Last active March 22, 2016 14:47
Abort Sensitive Files

These scripts are designed to be used as a pre-receive or update hook on a git server. The context is an Ansible project in which sensitive data is encrypted using Ansible vault, and with a convention that all encrypted files have the .vault extension. The python script (abort-sensitive-files.py) verifies that:

  1. Every file encrypted with Ansible vault has a name ending with .vault.
  2. Every file with a name ending with .vault is ecnrypted with Ansible vault.
  3. No file contains an RSA private key in plaintext.

It's called by the bash script abort-sensitive-files.sh, which will have to be renamed to 'pre-receive'

@antillean
antillean / git_file_at_date.sh
Created March 8, 2016 13:23
Git: get version of file at date
## The following checks out a file as it was on the current branch NUM_DAYS days ago.
## See manual page on gitlog for more date info: https://git-scm.com/docs/git-log
## (That includes info on the other ways of specifiying a date.)
git checkout `git log -n1 --before="${NUM_DAYS} days ago" --format="%H" path/to/file` path/to/file
@antillean
antillean / letsencrypt-cli.ini
Last active September 20, 2020 06:29
Sample letsencrypt-cli.ini file
# Becomes /etc/letsencrypt/cli.ini.
# This is an example of the kind of things you can do in a configuration file.
# All flags used by the client can be configured here. Run Let's Encrypt with
# "--help" to learn more about the available options.
# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096
# Uncomment and update to register with the specified e-mail address
@antillean
antillean / le-sub.example.com-renewal.sh
Last active March 18, 2020 19:05
Let's Encrypt renewal script for VSFTPD, mumble-server (and possibly other things)
#!/bin/sh
## Some notes:
## 1. This should be run as root!
## 2. This assumes that /etc/letsencrypt/cli.ini is sensibly specified.
## 3. /usr/local/sbin/le-sub.example.com-renewal.sh is a sensible place to put this.
## 4. A sensible crontab entry for this: 15 2 * * 1 /usr/local/sbin/le-sub.example.com-renewal.sh >> /var/log/le-sub.example.com-renewal.log
exp_limit=15;
le_path='/opt/letsencrypt';
@antillean
antillean / git-commit.groovy
Created April 5, 2015 11:38
Adds and commits all files, printing the output of each command. The noteworthy thing here is the second command, which has to be executed as an array rather than a String.
#!/usr/bin/env groovy
def process = "git add .".execute()
println process.text
// This next one has to be done as an array because of the space in the -am argument.
process = ["git", "commit", "-am 'First commit'"].execute()
println process.text