Skip to content

Instantly share code, notes, and snippets.

@werty1st
werty1st / bash.generate.random.alphanumeric.string.sh
Last active January 12, 2018 09:14 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/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
@werty1st
werty1st / icinga2_check_wmi_plus.conf
Created April 17, 2016 22:31 — forked from dayreiner/icinga2_check_wmi_plus.conf
An example check_wmi_plus configuration for Icinga2. Check_wmi_plus (http://www.edcint.co.nz/checkwmiplus/) is a clientless plugin for monitoring Windows systems via WMI with Nagios and other monitoring platforms.
object CheckCommand "check_wmi" {
import "plugin-check-command"
command = [ PluginDir + "/check_wmi_plus.pl" ]
arguments = {
"--inidir" = "$wmi_inidir$"
"-H" = "$host.name$"
"-A" = "$wmi_authfile_path$"
"-m" = "$check_mode$"
"-s" = "$wmi_submode$"
@werty1st
werty1st / new_gist_file
Created March 25, 2016 12:51
lets encrypt autorenew
root@s:/opt# cat autorenew.sh
#/bin/bash
cd /opt/letsencrypt/
git pull
/etc/init.d/nginx stop
result=$(/opt/letsencrypt/letsencrypt-auto renew)
/etc/init.d/nginx start
zertdate=$(echo | openssl s_client -connect ***.eu:443 2>/dev/null | openssl x509 -noout -startdate)
@werty1st
werty1st / couchdb.conf
Created March 1, 2016 21:02 — forked from fredrick/couchdb.conf
Upstart script for CouchDB
# Upstart file at /etc/init/couchdb.conf
# CouchDB
start on runlevel [2345]
stop on runlevel [06]
pre-start script
chown -R couchdb /usr/local/etc/couchdb
chown -R couchdb /usr/local/lib/couchdb
chown -R couchdb /usr/local/var/log/couchdb
@werty1st
werty1st / index.php
Last active December 1, 2015 13:54
php forward subdomain zu url
<?php
$subdomain = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
$urlmap = [
"spiel1" => "http://quiz.tivi.de/quiz/1057-toleranz-und-respekt/",
"spiel2" => "http://quartett.tivi.de/krasse-kolosse/",
"spiel3" => "http://fehlersuche.spiel.tivi.de/game/E2123874",
"spiel4" => "http://fehlersuche.spiel.tivi.de/game/A66FAF75",
];
@werty1st
werty1st / gist:2647f12f355d5e5f8b98
Last active November 19, 2015 10:38 — forked from jamesmr89/gist:77851acecda208ecc780
pfSense 1to1 NAT OpenVPN setup
Goal of this document is to describe how to setup a vpn tunnel with two pfSense boxes
having the same LAN subnet, for the purpose of this doc we'll use 192.168.1.1/24 on
both firewalls LAN interfaces
We have to make some dummy networks here to NAT to so as far as Site A will be concerned,
site B will be 192.168.2.0/24, and as far as Site B is concerened site A will be 192.168.3.0/24
SiteA (LAN 192.168.1.1)
OpenVPN Server:
Standard Setup and we'll use 10.0.1.0/24 as the Tunnel Network (I can elaborate here later)
function loadScript(url,callback,args) {
scriptEl = document.createElement('script');
scriptEl.type = 'text/javascript';
scriptEl.async = true;
scriptEl.src = url;
if (typeof(callback) === 'function'){
if ("onload" in scriptEl){
scriptEl.onload = function(){
function insertScript(url) {
scriptEl = document.createElement('script');
scriptEl.type = 'text/javascript';
scriptEl.async = true;
scriptEl.src = url;
document.getElementsByTagName('head')[0].appendChild(scriptEl);
}
@werty1st
werty1st / modemswitch
Last active August 29, 2015 14:24
umts modem 3g at command
apt-get install usb-modeswitch-\*
/usr/sbin/usb_modeswitch -v 12d1 -p 1446 -t option-zerocd
#dann neu reinstecken
udev erstellen:
/etc/udev/rules.d/70-usb-modeswitch.rules
# eigene udev-Regeln für UMTS-Sticks
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="/usr/sbin/usb_modeswitch -v 12d1 -p 1446 -M '55534243123456780000000000000011062000000100000000000000000000'"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1001", RUN+="/bin/bash -c 'modprobe option && echo 12d1 1001 > /sys/bus/usb-serial/drivers/option1/new_id'"

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"