Skip to content

Instantly share code, notes, and snippets.

View jfqd's full-sized avatar

Stefan Husch jfqd

View GitHub Profile
@jfqd
jfqd / opnsense_create_certificate.sh
Created November 6, 2019 19:31
Create a certificate in a OPNsense appliance via the api
curl \
-XPOST \
-H "Content-Type: application/json" \
-u "user:pass" \
https://opnsense.example.com/api/acmeclient/certificates/add -d \
'{
"certificate": {
"enabled": "0",
"name": "test.example.com",
"altNames": "test2.example.com",
@jfqd
jfqd / zfsbackup
Last active October 27, 2019 13:40
zfs backup solution
#!/usr/bin/env ruby
# install ruby requirements with:
# gem install terrapin
require 'terrapin'
require 'logger'
# Usage:
# DELETE_SNAPSHOTS=false DEBUG=true zfsbackup backup-storage.example.com local/pool remote/pool
@jfqd
jfqd / svn_to_git.rst
Created October 19, 2019 16:30 — forked from epicserve/svn_to_git.rst
Convert SVN Repositories to Git Repositories

Convert SVN Repositories to Git Repositories

This guide on how to convert an SVN repository to a git repository was mostly taken from John Albin Wilkins post on Converting a Subversion repository to Git.

1. Retrieve a list of all Subversion committers

:

@jfqd
jfqd / install_CUPS_all_defaults.sh
Created October 1, 2019 12:24 — forked from aweijnitz/install_CUPS_all_defaults.sh
Installing CUPS printer on Debian and add PDF printer
#!/bin/bash
sudo apt-get -y install cups
sudo apt-get -y install cups-pdf
# add pdf printer to cups
# - named files end up in ~/PDF/
# - unnamed files are stored in /var/spool/cups-pdf/ANONYMOUS/, such as PDF:s created by streaming bytes over an API
sudo lpadmin -p cups-pdf -v cups-pdf:/ -E -P /usr/share/ppd/cups-pdf/CUPS-PDF.ppd
@jfqd
jfqd / usbupdate
Created May 28, 2019 12:41 — forked from sjorge/usbupdate
#!/usr/bin/bash
## CONFIG
# Lookup USBKEY: disklist -r
AUTO_REBOOT=1
MIRROR=us-east.manta.joyent.com
USBKEY=c1t0d0
## INIT
CURRENT_REFERENCE=$(curl -s -k https://${MIRROR}/Joyent_Dev/public/builds/smartos/ | grep release | tail -n 1 | json name)
@jfqd
jfqd / girosolution.rb
Last active December 19, 2018 12:11
ActiveMerchant Girosolution-Gateway
require 'openssl'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
#
# = Girosolution Gateway
#
# == Usage
#
# require 'active_merchant'
#

Use GnuPG to sign pkgsrc packages on SmartOS

I hope you have an public an private key already. If not there a lot of manuals out there who explain that very well.

Install the requirements

I would like to use gpg version 2 which supports gpg agent.

pkgin in gnupg2
#####################################
# Postfix
#
if [type] == "redis-input" and "postfix" in [@tags] {
grok {
match => [ "@message", "%{PF}" ]
add_tag => [ "postfix", "grokked" ]
patterns_dir => [ "/opt/logstash/patterns-extensions/" ]
}
@jfqd
jfqd / Snom.scpt
Last active October 5, 2018 07:30
This script enables the macOS Contact-Application to dial a phone-number via a SNOM hardware phone by clicking on the phone label
-- This script enables the macOS Contact-Application to dial a phone-number
-- via a SNOM hardware phone by clicking on the phone label.
--
-- (C) 2008 David Kreitschmann, K3com Kommunikationstechnik http://www.k3com.de
-- (C) 2017 Modification for SNOM 715 by Stefan Husch, https://qutic.com
--
-- Copy this script to ~/Library/Application\ Scripts/com.apple.AddressBook
-- on your macOS 10.11+ and change the phoneURL to your needs.
--
-- A chmod 0600 ~/Library/Application\ Scripts/com.apple.AddressBook/Snom.scpt
#!/bin/bash
# Build OpenVPN on Nexenta NCP 3.0.1
# (c) 2010 qutic development
# Make sure only root can run this script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi