Skip to content

Instantly share code, notes, and snippets.

View martinhbramwell's full-sized avatar
🏠
Creating a serverless, offline-first, single page progressive web app with VueJS

Martin H. Bramwell martinhbramwell

🏠
Creating a serverless, offline-first, single page progressive web app with VueJS
View GitHub Profile
@martinhbramwell
martinhbramwell / installSaltNode.sh
Last active December 30, 2015 06:09
Install and run SaltStack from source on Saucy Salamander
#!/bin/bash
#
set -e
#
export YES="Yes"
export NO="No"
export WAIT=2
#
export NAME_MASTER="salt_mstr"
export ID_MINION="$(hostname)"
@martinhbramwell
martinhbramwell / PrepareVirtualenv.sh
Last active December 29, 2015 22:59
Establish a Python virtualenv (with wrapper toolkit).
#!/bin/bash
# --
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
#
mkdir -p ~/tmpxxxxxtmp
pushd ~/tmpxxxxxtmp
apt-get install curl
@martinhbramwell
martinhbramwell / get_google_oauth2_creds.py
Last active December 28, 2015 19:58
Simple command line script to prepare a full set of Google API's OAuth2 credentials as Python variables.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
'''
This script will attempt to open your web browser,
perform OAuth 2 authentication and print out your full set
of OAuth credentials in the form of Python variable declarations.
It depends on Google's Python library: oauth2client.
@martinhbramwell
martinhbramwell / getGSpreadAsHTML.sh
Last active December 26, 2015 02:08
Simple script to get an HTML version of a Google Spreadsheet
#!/bin/bash
AUTH=$(curl -s https://www.google.com/accounts/ClientLogin --data-urlencode Email=$1 --data-urlencode Passwd=$2 -d accountType=GOOGLE -d service=wise | grep -Po '(?<=Auth=)[^;]+')
curl -o temp.html --silent --header "Authorization: GoogleLogin auth=$AUTH" "https://docs.google.com/feeds/download/spreadsheets/Export?exportFormat=html&key=$3&gid=$4"
cat temp.html
echo
echo Google ID is : $1
echo Google password is : $2
echo Google spreadsheets workbook key is : $3
echo Sheet id number is : $4
@martinhbramwell
martinhbramwell / aptFix.sh
Last active December 18, 2016 11:25
The usual apt commands
sudo apt-get install tlsdate
sudo tlsdate -H mail.google.com
# sudo ntpdate -sb time.nist.gov
sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y clean && sudo apt-get -y autoremove;
# # Update to head of list
@martinhbramwell
martinhbramwell / Downgrade_Firefox_to_v22
Last active December 20, 2015 20:09
Downgrade Firefox to v22 Get rid of the official install in my Ubuntu machine, then create a local copy in my own account. This is a *cheap* fix for a development virtual machine; not intended for long-term use. See installation instruction in the shorter file.
Usage :
wget -N https://gist.github.com/martinhbramwell/6188800/raw/f17fdc1ad7f3217059bfe963db175e34a5ded21f/downgrade_firefox.sh
chmod a+x downgrade_firefox.sh
sudo ./downgrade_firefox.sh
# drag the desktop icon to the launcher
# click on it
# you should be back in action
@martinhbramwell
martinhbramwell / prepPreciseDeskTop.sh
Last active December 19, 2015 02:59
The script I use to prepare a raw Ubuntu 12.04 LTS installation. There's not a lot fluff here. Just enough to make it easy to run the installers of the other stuff with which I work. Typically I leave Ubuntu 12.04 to install itself in a VM, then run this to add your basic Python / PostgreSQL development
#!/bin/bash
#
apt-get -y update
apt-get -y upgrade
apt-get -y remove --purge libreoffice*
apt-get -y install myunity
apt-get -y install python-dev # Urgent for Flask build
@martinhbramwell
martinhbramwell / resizeIcons.py
Created June 28, 2013 19:11 — forked from anonymous/resizeIcons.py
A script to change the size of Launcher icons of Unity 2D. Ubuntu 12.04 LTS
#!/usr/bin/python
import shutil
import sys
import os
def getparent (content, line_nr):
for i in range (line_nr - 1, -1, -1):
if "{" in content[i].lstrip():
return content[i].lstrip().split(" ")[0]
@martinhbramwell
martinhbramwell / orm.patch
Created April 23, 2013 13:49
OpenERP V7 patch for the bug "OpenERP 6.1 - Export of users data fails" https://bugs.launchpad.net/openobject-server/+bug/985329 ||| Also, please refer to this discussion : http://help.openerp.com/question/12789/whats-the-correct-way-to-access-technical-features/ ||| Usage: With wget, download the "raw" version of this file to your directory ${o…
--- orm.py 2013-04-23 08:51:16.221986798 -0400
+++ orm.py 2013-04-23 07:23:08.049987030 -0400
@@ -1144,17 +1144,20 @@
elif f[i] == 'id':
r = _get_xml_id(self, cr, uid, r)
else:
- r = r[f[i]]
- # To display external name of selection field when its exported
- if f[i] in self._columns.keys():
- cols = self._columns[f[i]]
@martinhbramwell
martinhbramwell / getRowCounts.sh
Created December 30, 2012 14:55
A bash script to compare row counts of tables in two databases on separate machines
#!/bin/bash
#
DROP_ROWCOUNTS="\"DROP TABLE IF EXISTS rowcounts;\""
MAKE_ROWCOUNTS="\"CREATE TABLE rowcounts
(
name_server character varying(64) NOT NULL
, name_table character varying(64) NOT NULL
, count integer
);\""
#