Skip to content

Instantly share code, notes, and snippets.

View mvrilo's full-sized avatar
🌳

Murilo Santana mvrilo

🌳
View GitHub Profile
#!/bin/bash
if [[ "$(uname -s)" == "Darwin" ]]; then
route get 0 | awk '/interface: /{print $NF}'
else
route | awk '/default /{print $NF}'
fi
@mvrilo
mvrilo / nginx.conf
Created October 15, 2016 23:06 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
#!/usr/bin/env bash
bytesToHuman() {
b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB)
while ((b > 1024)); do
d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))"
b=$((b / 1024))
let s++
done
echo "$b$d ${S[$s]} of space was cleaned up :3"