Skip to content

Instantly share code, notes, and snippets.

View jfqd's full-sized avatar

Stefan Husch jfqd

View GitHub Profile
@jfqd
jfqd / 1_create_etherstub_and_vnics.bash
Created February 26, 2012 16:38
Crossbow - Network in a Box - Samples build for OpenIndiana 151a
#!/bin/bash
# create a virtual switch
dladm create-etherstub vswitch0
# create a virtual nic connected to a physical nic
dladm create-vnic -l e1000g0 vnic_ext0 # dns
# create virtual nics connected to a virtual switch
dladm create-vnic -l vswitch0 vnic_int0 # dns
@jfqd
jfqd / rc-backup
Last active September 18, 2022 08:20
Save Rocket.Chat Backup to another host and preserve the last 7 versions
#!/usr/bin/bash
# You may create a crontab entry like:
# 0 1 * * * /usr/local/bin/rc-backup
# and change the following four vars:
_URL="rc.example.com"
_USR="rc-backup"
_PWD="<long-secure-password>"
_CWD="/home/jfqd/rc-backup"
@jfqd
jfqd / immuniweb_mx_scans.md
Last active September 17, 2022 19:10
immuniweb mailserver scans
@jfqd
jfqd / z.bash
Created November 11, 2020 13:27
convenient login script for SmartOS zones (native, lx, kvm)
#!/usr/bin/bash
if [[ "$1" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]]; then
if [[ $(/usr/sbin/vmadm lookup uuid="$1" -j -o type | /opt/tools/bin/jq '.[][]') = "KVM" ]]; then
/usr/sbin/vmadm console "$1"
else
/usr/sbin/zlogin "$1"
fi
else
uuid=$(/usr/sbin/vmadm lookup alias="$1")
brand=$(/usr/sbin/vmadm lookup alias="$1" -j -o type | /opt/tools/bin/jq '.[][]' |sed 's/"//g')
@jfqd
jfqd / 0001-remove-upgrade-option.v4.6.4.patch
Last active August 9, 2022 15:22
Remove "Go fully featured" admin option as long it is not GDPR complient
From 162ff8353b9cf299b8b0673f7f45d981712fbb23 Mon Sep 17 00:00:00 2001
From: jfqd <jfqd@blun.org>
Date: Tue, 9 Aug 2022 17:13:09 +0200
Subject: [PATCH] remove upgrade option
---
client/sidebar/header/UserDropdown.tsx | 2 +-
client/views/admin/AdministrationRouter.tsx | 2 +-
client/views/admin/routes.js | 5 -----
client/views/admin/sidebar/AdminSidebarPages.tsx | 4 ----
require 'shiparound_api/rest'
require 'rest-client'
require 'openssl'
require 'base64'
require 'json'
require 'uri'
# auth_code, error = ::ShiparoundApi::AuthCode.get(
# password: "password",
# api_key: "api_key",
#!/bin/bash
echo "scale=2;$@" | tr -d "." | tr "," "." | bc | tr -d "," | tr "." ","
@jfqd
jfqd / sample.php
Created February 1, 2022 16:26 — forked from kkosuge/sample.php
PHP <=> Ruby ( OpenSSL AES-256-CBC )
<?php
const PASSWORD = '!!!!!sufficiently_long_password!!!!!';
const CIPHER_METHOD = 'AES-256-CBC';
function encrypt($str) {
$iv_length = openssl_cipher_iv_length(CIPHER_METHOD);
$iv = mcrypt_create_iv($iv_length, MCRYPT_RAND);
$str = $iv.$str;
$val = openssl_encrypt($str, CIPHER_METHOD, PASSWORD, 0, $iv);
@jfqd
jfqd / install_openvpn.bash
Created May 5, 2021 12:46
Install OpenVPN with Homebrew on macOS
# install homebrew if not yet done
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# fix me!
IP_ADDRESS="91.123.123.123"
LOCAL_NET="10.168.231.0"
CERTNAME="name.example.com"
brew analytics off
brew install openvpn
@jfqd
jfqd / build_minio_client_on_SmartOS
Last active May 3, 2021 12:36
Build minio version 2021-04-22T15-44-28Z on SmartOS with pkgsrc:
go get -d github.com/minio/mc
GOOS=solaris GOARCH=amd64 GO111MODULE=on go get github.com/minio/mc