Skip to content

Instantly share code, notes, and snippets.

View andygock's full-sized avatar

Andy Gock andygock

View GitHub Profile
@andygock
andygock / firefox_set_homepage.sh
Created November 12, 2015 10:12
Bash shell script to set Firefox homepage
#!/bin/bash
# Script to change Firefox homepage in Linux
#
# Full path to 'profiles.ini'
PROFILES_INI=/home/$(whoami)/.mozilla/firefox/profiles.ini
if [ ! $1 ]; then
echo "Set URL as 1st argument"
exit 1
@andygock
andygock / dlink_stats.py
Created September 10, 2013 15:17
Rip ADSL statistics from D-Link ADSL router DSL-2870B with firmware 2.00.01 ## Example of usage $ python dlink_stats.py Logging in... Getting device info... DSL is connected! Getting stats... DSL Statistics: up_attaintable_rate 388000 down_attaintable_rate 8004000 down_data_rate 6214000 up_data_rate 350000
#!/usr/bin/env python
"""
Multithreaded avrdude invoking script, to upload firmware
to RTU units.
Supports Windows, Mac, and Linux!
Designed to upload via multiple USB virtual serial ports at the
same time
@andygock
andygock / speccy-table.py
Created November 10, 2016 09:04
Given a directory Speccy exported XML files, generate a HTML page with summary of all machines in a table format.
"""
speccy-table.py
Given a directory of Speccy exported XML files, generate a HTML
page with summary of all machines in a table format.
"""
import xml.etree.ElementTree as ET
@andygock
andygock / letsencrypt-nginx.md
Created January 26, 2017 01:42
Lets Encrypt configuration with Nginx

Let's Encrypt

Allow web server to read /.well-known/acme-challenge/ from each domain. This path is used by the webroot plugin.

In nginx, we can add the following to each server block configuration:

location ^~ /.well-known/acme-challenge/ {
    default_type "text/plain";
    root /home/www/letsencrypt;

}

@andygock
andygock / download-jre.sh
Created June 2, 2017 09:29
Bash script: Download latest JRE offline installer
#!/bin/bash
#
# Download latest JRE for Windows x64
page="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html"
# Edit this for other platforms
url=$(curl -s "$page" \
| grep "downloads\[.*jre-.*filepath" | cut -d ',' -f 3 | cut -d '"' -f 4 | grep "x64.exe$")
@andygock
andygock / download-libreoffice.sh
Last active June 2, 2017 09:34
Bash script: Download latest stable LibreOffice for Windows x86
#!/bin/bash
#
# Download latest stable LibreOffice for Windows x86
#
urla=$(curl -s "https://www.libreoffice.org/download/download/" \
| grep "option.*type=win-x86\&" | head -n 2 | cut -d '"' -f 2 | tail -n 1)
urlb=$(curl -s "$urla" | grep "\.msi" | grep -v "torrent" | tail -n 1 | cut -d '"' -f 6)
@andygock
andygock / download-reader11-update.sh
Created June 2, 2017 15:50
Bash script: Download latest Adobe Reader 11 update installer
#!/bin/bash
#
# Download latest Adobe Reader 11 update installer
#
page2=$(curl -s "http://supportdownloads.adobe.com/product.jsp?product=10&platform=Windows" \
| grep "Adobe Reader 11.*update - All" \
| head -n 1 \
| cut -d '"' -f 2)
echo "> $page2"
@andygock
andygock / yt-rip.py
Last active June 2, 2017 15:52
Rip album of AAC audio from Youtube playlist with youtube-dl
#/usr/bin/env python
"""
Prerequisites:
* python
* youtube-dl https://rg3.github.io/youtube-dl/
* (not required yet) mutagen (pip install mutagen)
@andygock
andygock / download-sublimetext3.sh
Created June 4, 2017 13:31
Bash script: Download latest Sublime Text 3 installer
#!/bin/bash
# Download latest Sublime Text 3 installer
url=$(curl -s "https://www.sublimetext.com/3" \
| grep "dl_linux.*tarball" \
| cut -d '"' -f 6)
curl "$url" -o ${url##*/}
# Example of installation:
#
# tar -jxvf sublime_text_3_build_3126_x64.tar.bz2 -C ~