Skip to content

Instantly share code, notes, and snippets.

@svicknesh
svicknesh / makepasswd
Last active May 28, 2017 05:51
Generate passwords like OSX in Command Line
#!/bin/bash
string=$(openssl rand -base64 15 | sed -e ':a;N;$!ba;s/\n//g' -e 's/[^a-zA-Z0-9]//g' -e "s/ //g")
echo ${string:0:3}-${string:3:3}-${string:6:3}-${string:9:3}
@svicknesh
svicknesh / theme.html
Created May 28, 2017 05:56 — forked from soemarko/theme.html
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
#!/bin/bash
#sudo sh -c "TERM=linux setterm -blank X >/dev/tty0"
# where X is number in minutes. If set to 0, screen will disable blanking.
# Turn the screen on and blank it again after 5 minute(s)
sudo sh -c "TERM=linux setterm -blank 5 >/dev/tty0"
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_PASSWORD"
key_mgmt=WPA-PSK
}
#!/bin/bash
echo -ne "\033[9;0]" >/dev/tty1
#!/bin/bash
# Set the Pi Zero ACT LED trigger to 'none'.
echo none | sudo tee /sys/class/leds/led0/trigger
# Turn off the Pi Zero ACT LED.
echo 1 | sudo tee /sys/class/leds/led0/brightness
#!/bin/bash
if [ -z "${VPN_NAME}" ]
then
VPN_NAME="vpnname"
fi
if [ -z "${MY_NAME}" ]
then
MY_NAME="thisisme"
export VPN_NAME="my_private_vpn"
export MY_NAME="ubuntu"
export VPN_IP="172.16.1.1" # change this to be different for each node
export CONNECTION="WAN" # is this server connected to a "WAN" or "LAN"
export MY_HOSTNAME="ubuntu.server.com"
export TINC_PORT="655"
export AUTO_TRUE="YES"
export VPN_NAME="my_private_vpn"
export MY_NAME="raspi"
export VPN_IP="172.16.1.2" # change this to be different for each node
export CONNECTION="LAN" # is this server connected to a "WAN" or "LAN"
export TINC_PORT="655"
export AUTO_TRUE="YES"
@svicknesh
svicknesh / htpasswd-ssl.sh
Created October 6, 2017 03:07 — forked from samba/htpasswd-ssl.sh
htpasswd replacement with openssl
#!/bin/sh
# Writes an APR1-format password hash to the provided <htpasswd-file> for a provided <username>
# This is useful where an alternative web server (e.g. nginx) supports APR1 but no `htpasswd` is installed.
# The APR1 format provides signifcantly stronger password validation, and is described here:
# http://httpd.apache.org/docs/current/misc/password_encryptions.html
help (){
cat <<EOF
Usage: $0 <htpasswd-file> <username>