Skip to content

Instantly share code, notes, and snippets.

View ankel's full-sized avatar

Binh Tran ankel

  • Jive Communications
  • Toronto, ON, Canada
View GitHub Profile
@ankel
ankel / pwgen.py
Last active May 26, 2021 14:59
Generate password with configurable included character classes.
#!/usr/bin/env python3
import argparse
import secrets
import string
def GetParser():
parser = argparse.ArgumentParser(description="A very opinionated password generator.")
parser.add_argument(
'-a', '--lower', action='store_const', const=True, help='include lower case alphabets, default is true.')
@ankel
ankel / check_con.sh
Created February 18, 2015 06:51
Cron job that runs once every 10m and reset wlan0 if no internet connection is detected
#!/bin/bash
ping -c 1 google.com > /dev/null & wait $!
if [ $? != 0 ]; then
echo "$(date) Wifi down, resetting" >> /var/log/wifi.log
sudo ifdown wlan0 & wait $!
sudo ifup wlan0 & wait $!
else echo "$(date) Wifi up" >> /var/log/wifi.log
fi