Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@simonclausen
simonclausen / saltstack.sh
Created June 21, 2019 11:59 — forked from michaelkarrer81/saltstack.sh
[Saltstack Cheat Sheet] #saltstack
# ============
# COMMON TASKS
# ============
# Run state.sls file on minion(s)
salt -G 'os:Ubuntu' state.apply ubuntu1401 # Formula file name without .sls at the end
salt -G 'os:Ubuntu' state.apply ubuntu1401 test=True # Test only (dryrun)
salt -G "minion_roles:ONLINE" state.apply execute_script_example pillar='{"single_instance_update": "aiat"}'
# Webhook state.sls example
@simonclausen
simonclausen / Caddyfile
Last active March 12, 2020 20:43
Caddy log format for JSON
log / stdout "\{\"hostname\":\"{host}\",\"remote\":\"{remote}\",\"user\":\"{user}\",\"when_iso\":\"{when_iso}\",\"method\":\"{method}\",\"host\":\"{host}\",\"uri\":\"{uri}\",\"proto\":\"{proto}\",\"status\":\"{status}\",\"size\":\"{size}\",\"query\":\"{query}\",\"mitm\":\"{mitm}\",\"latency_ms\":\"{latency_ms}\",\"tls_cipher\":\"{tls_cipher}\",\"tls_version\":\"{tls_version}\",\"scheme\":\"{scheme}\",\"referer\":\"{>Referer}\",\"user_agent\":\"{>User-Agent}\",\"fragment\":\"{fragment}\"\}"
@simonclausen
simonclausen / gist:905dba3d0ba9de928b3d832fa92fd0a1
Created June 13, 2018 11:32 — forked from marvin/gist:1017480
syslog calculate facility and severity from PRI(priority)
example:
PRI = 191
To get the Facility
Divide the PRI number by 8.
191/8 = 23.875
The whole number part is the facility.
To get the Severity

Installing dnsperf and resperf

This example is installation from source on Debian 9. Package installs are dependencies for the build. These should apply to other distributions as well.

After dependcies are installed, the usual configure, make, make install can be done.

apt-get install -y bind9utils libbind-dev gnuplot libkrb5-dev libssl-dev libcap-dev libxml2-dev libgeoip-dev
wget ftp://ftp.nominum.com/pub/nominum/dnsperf/2.1.0.0/dnsperf-src-2.1.0.0-1.tar.gz
tar -zxvf dnsperf-src-2.1.0.0-1.tar.gz
# on port 9201
DELETE /index_es1
PUT /index_es1
{
"settings": {
"number_of_shards": 1
, "number_of_replicas": 0
}
@simonclausen
simonclausen / gist:a406aee272849171af44
Last active August 29, 2015 14:25 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this "howto" is to document how browsing can be done in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the "How to Contribute" section for information on contributing your own knowledge.

Table of Contents

Keybase proof

I hereby claim:

  • I am simonclausen on github.
  • I am simonclausen (https://keybase.io/simonclausen) on keybase.
  • I have a public key whose fingerprint is A700 5232 8E11 02DE F388 4C48 5BDF 72E1 8DF6 BC05

To claim this, I am signing this object: