Skip to content

Instantly share code, notes, and snippets.

@rmarchei
rmarchei / import_certs.sh
Created June 8, 2016 23:30
Import Let's Encrypt certs to JDK
#!/bin/bash
set -e
STOREPASS=changeit
BACKUP=false
function usage {
echo "Usage: $0 [-h] [-b] [-s password] /path/to/java/home"
echo " -h: show usage"
echo " -b: backup keystore file"
@rmarchei
rmarchei / is_public.rb
Created June 17, 2016 06:24
Test if an IP is public
def is_public?(ip)
["127.0.0.0/8", "192.168.0.0/16", "172.16.0.0/12", "10.0.0.0/8"].map { |net| (IPAddr.new net).include?(IPAddr.new ip) }.none?
end
@rmarchei
rmarchei / SolrExporter.groovy
Last active November 12, 2016 02:36 — forked from ndpar/SolrExporter.groovy
Export documents from Solr core to XML format
#!/usr/bin/env groovy
/**
* Usage: ./SolrExporter.groovy query url [url]
*
* ./SolrExporter.groovy "id:12345" "http://your.solr.host:8983/solr/core/"
*
* ./SolrExporter.groovy "id:12345" "http://old.solr.host:8983/solr/core/" "http://new.solr.host:8983/solr/core/"
*
*
@rmarchei
rmarchei / 99-vagrant.rules
Last active February 17, 2017 12:04
Ubuntu Xenial on Vagrant: workaround for 'Medium access timeout failure. Offlining disk!'
ACTION=="add", SUBSYSTEM=="scsi" , ATTR{type}=="0|7|14", \
RUN+="/bin/sh -c 'echo 180 > /sys$$DEVPATH/timeout'"
@rmarchei
rmarchei / route53.py
Last active June 16, 2022 04:11
route53 hook for dehydrated - python2 / python3 + boto2 version. Tested on Ubuntu 16.04
#!/usr/bin/env python
# How to use:
#
# Ubuntu 16.04: apt install -y python-boto OR apt install -y python3-boto
#
# Specify the default profile on aws/boto profile files or use the optional AWS_PROFILE env var:
# AWS_PROFILE=example ./dehydrated -c -d example.com -t dns-01 -k /etc/dehydrated/hooks/route53.py
#
# Manually specify hosted zone: