Skip to content

Instantly share code, notes, and snippets.

View andygock's full-sized avatar

Andy Gock andygock

View GitHub Profile
@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
@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
::
:: Windows batch script to clear Firefox history.
::
:: Requires:
::
:: SDelete - https://technet.microsoft.com/en-us/sysinternals/sdelete.aspx
:: If you do not have SDelete, replace instances of 'sdelete' in this script with 'del'
::
:: sqlite3 - https://www.sqlite.org/download.html
::
#!/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 / Windows 10 Tips.md
Last active May 6, 2024 07:03
Windows 10, remove bloatware and fix privacy issues. My personal notes for fresh installing Windows 10.
@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 / 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 / sync-to-external.cmd
Created April 14, 2017 08:09
Script to sync one directory to another using robocopy (suitable as a form of backup)
@echo off
setlocal
:: set target and source directory, do not use a trailing slash
:: recommended: sync to a subdir on target drive
set source_drive=z:
set target_drive=p:\drive_z
:: exclude these dirs from sync
set excluded_dirs=exclude1 exclude2 "exclude 3"
@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$")