Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gsanders5 on github.
  • I am grahamsanders (https://keybase.io/grahamsanders) on keybase.
  • I have a public key ASDxJbSIJYJOUCwR614Gn58N2LR8x7br090yE-zeBCylqQo

To claim this, I am signing this object:

@gsanders5
gsanders5 / onlogin.sh
Last active April 9, 2017 22:57
Start and maintain am openvpn connection
#!/bin/bash
# Test an IP address for validity:
# Usage:
# valid_ip IP_ADDRESS
# if [[ $? -eq 0 ]]; then echo good; else echo bad; fi
# OR
# if valid_ip IP_ADDRESS; then echo good; else echo bad; fi
#
function valid_ip()
@gsanders5
gsanders5 / example.nginx
Last active August 18, 2022 06:20
Automatic nginx virtual subdomains with sub-folders or sub-directories
# Automatic nginx virtual subdomains with sub-folders or sub-directories
#
# Since the original source where I found this code is now offline, I have decided to mirror it here.
# All credit goes to: http://web.archive.org/web/20150307193208/http://www.messaliberty.com/2010/10/automatic-nginx-virtual-subdomains-with-sub-folders-or-sub-directories
#
# Description: In my web root directory I wanted create a folder called photos, and another called
# music using a sftp program. Without manually going back to the config file or to the shell I like to
# be able to access them at photos.nginxdomain.com and music.nginxdomain.com. That is what this config does.
# Redirect visitors from http://nginxdomain.com/ to http://www.nginxdomain.com/
#!/bin/bash
# To run without saving this script...
# bash <(curl -s https://gist.githubusercontent.com/Raveanox/da14bd074971233a9a265a643fa25b1e/raw)
dir=$(mktemp --directory)
cd $dir
wget -qO- https://github.com/google/fonts/archive/master.tar.gz | tar -xvzf-
mkdir google-fonts
cd fonts-master
@gsanders5
gsanders5 / ddns.sh
Created May 22, 2016 01:20 — forked from lyoshenka/ddns.sh
Quick and dirty DDNS using Bash and Cloudflare
#!/usr/bin/env bash
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your token is here: https://www.cloudflare.com/my-account
# Step 2: Create an A record on Cloudflare with the subdomain you chose
# Step 3: Run "./ddns.sh -l" to get the rec_id of the record you created.
# Fill in REC_ID below
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating.
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output
# 0 * * * * /path/to/ddns.sh -s
@gsanders5
gsanders5 / reset.css
Created November 23, 2015 22:36
HTML Reset CSS
/* Rvnx CSS Reset */
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,
caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,
figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,
legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,
strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,
video{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline}article,
aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}
body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,
blockquote:before,q:after,q:before{content:'';content:none}table{