Skip to content

Instantly share code, notes, and snippets.

View hansdg1's full-sized avatar

Hans Guthrie hansdg1

View GitHub Profile
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script will be updated for every JDK release.
## Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
# 3. Downloads the following from Oracle Website with one shell invocation.
# a. Windows 64 and 32 bit;
@hansdg1
hansdg1 / EdgeMax-Google-TV.sh
Last active December 9, 2015 05:04 — forked from stevejenkins/EdgeMax-Google-TV.sh
Additional script for Google Fiber TV customers to run on their EdgeRouter, after running the initial EdgeMax-Google.sh script, to enable TV service.
# Google Fiber TV Service Additional Script
# Based on Atlantisman's TV script
# http://blog.nexusshield.com/google-fiber-ubiquitis-edgerouter/
# Edited by Steve Jenkins to work with his version of the script
#______________________TV Service Config _____________________
#Setup IGMP Proxy
configure
edit protocols igmp-proxy
set interface eth1.2 role upstream
set interface eth0 role downstream
@hansdg1
hansdg1 / EdgeMax-Google.sh
Created December 9, 2015 05:04 — forked from stevejenkins/EdgeMax-Google.sh
Setup script for EdgeMax EdgeOS 1.7 routers to replace the Google Fiber Network Box
# EdgeOS v1.7 Google Fiber Config Script
# by Steve Jenkins (http://www.stevejenkins.com/)
# Last updated: Nov 8, 2015
# Based on settings & scripts by Atlantisman, TK, and CompTech
# RUN THIS SCRIPT AS ROOT ON YOUR EDGEROUTER
# Script runs best if you copy and paste in sections
#____________________Internet Service Config_____________________
configure
# Author: Hans Guthrie
# Date: 6/19/2016
# Purpose: Set audio track language to English for all mkvs in current and subfolders
# Future: Support multiple audio tracks, allow update individual tracks or all,
# Test mode using an argument
#find . -type f -iname *.mkv -print0 | xargs -0
unmodified=/tmp/unmodified-eng.tmp
modified=/tmp/modified-eng.tmp
# Author: Hans Guthrie
# Date: 7/18/2016, updated 10/3/2016
# Purpose: Update letsencrypt certificate. This script is typically run from a crontab job to make this process automatic
# Future: Improve logging functionality and make it cleaner
# Notes: See this website for how I got the date and time logging: https://www.evernote.com/shard/s57/nl/6650561/877447ff-6220-42d9-8e53-ddb7580cd562?title=log%20bash%20script%20output%20to%20file%20with%20timestamp
# Gist: https://gist.github.com/hansdg1/31a7a605f10e67c4e8b0b597657443ac
LOGFILE=/var/log/letsencrypt/certbox-renew.log
@hansdg1
hansdg1 / pytest.py
Last active September 23, 2016 23:35
#!/usr/bin/python
count = 0
while count < 9:
print 'The count is', count
count += 1 #remember this could be count = count + 1
## It prints:
# The count is 0
# The count is 1
#!/usr/bin/env python
# Hans Guthrie
# 10/10/2016
#
# Purpose:
# Used to download free ebooks from oreilly.com
# http://www.oreilly.com/programming/free/
# Takes an input file of URLs (urls.txt) with one URL per line.
# Does some tweaking of the URL, and adds extensions for the file types Oreiley offers
@hansdg1
hansdg1 / ddnsupdate
Created November 5, 2016 20:09
Dynamic DNS Update script for EdgeRouter Lite
#!/bin/bash
# Author: Hans Guthrie
# Date: 11/5/2016
# Purpose: Updates dynamic dns (ddns) on eth0.
# This is needed because our current ddns supplier, noip, expires your hostname after 28 days of inactivity.
# Surprisingly there's no better way to accomplish this than to use a cron job.
# Takes advantage of the operational command wrapper that is documented here:
# https://help.ubnt.com/hc/en-us/articles/204976164-EdgeMAX-How-to-run-operational-mode-command-from-scripts-
@hansdg1
hansdg1 / install_my_packages.sh
Last active January 22, 2017 00:13
Automatically install packages after a firmware upgrade to the ERLite
#!/bin/bash
# Installed by: Hans Guthrie
# Date: 11/6/2016
# Install dir: /config/scripts/post-config.d/
# Notes: The purpose of this file is to automatically install packages after a firmware upgrade to the
# ERLite. After every upgrade, the /config directory is copied to the new image.
# Followed steps from here:
# https://help.ubnt.com/hc/en-us/articles/204961814-EdgeMAX-Are-my-changes-lost-when-I-upgrade-the-firmware-image-
#
@hansdg1
hansdg1 / gist:a2b6e683650381971e489512aff5b378
Created November 13, 2016 21:34
Check ubuntu/debian has a reboot pending. If so, print details
alias rbr2="if [ -f /var/run/reboot-required ]; then cat /var/run/reboot-required; echo -e 'Packages pending reboot:'; cat /var/run/reboot-required.pkgs | sed 's/^/ /' ; fi"