Skip to content

Instantly share code, notes, and snippets.


Stewart Henderson bowlofstew

View GitHub Profile
bowlofstew /
Last active Jan 23, 2019
#!/usr/bin/env python2
import pyodbc
server = ${sql_name}
database =${sql_database}
username = ${sql_username}
password = ${sql_password}
driver= '{ODBC Driver 17 for SQL Server}'
cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
View AzureMaint.ps1
<# .SYNOPSIS Perform index maintenance .DESCRIPTION This runbook uses Azure Automation to perform reindexing and statistics maintenance of all databases on a target server. As prerequisite, please create an Azure Automation credential asset that contains the username and password for the target Azure SQL DB logical server ($SqlServerName). Make sure that you have installed the scripts IndexOptimize.sql, CommandLog.sql and CommandExecute.sql of Ola Hallengren ( Make sure to get Ola's modified scripts which work on Azure here: .EXAMPLE SQLServerIndexMaintenance .NOTES AUTHOR: Original author Pieter Vanhove: Heavily modified by Larry Silverman, CTO, TrackAbout Very slightly modified by Alexander Arvidsson: #>
workflow AzureMaint
param (
# Credentials for $SqlServerName stored as an Azure Automation credential asset
# When using in th
bowlofstew /
Created Jan 17, 2019 — forked from roydekleijn/
Selenium WebDriver Javascript execution for localStorage
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class LocalStorage {
private JavascriptExecutor js;
public LocalStorage(WebDriver webDriver) {
this.js = (JavascriptExecutor) webDriver;
bowlofstew / cursed_mandelbrot.c
Created Nov 14, 2018 — forked from DavidBuchanan314/cursed_mandelbrot.c
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout.
View cursed_mandelbrot.c
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
bowlofstew / callback_manager.h
Created Nov 12, 2018 — forked from daniel5151/callback_manager.h
Generic Callback Manager
View callback_manager.h
#pragma once
#include <vector>
#include <cstddef>
* Generic Callback Manager
* @tparam ...cb_args Types of callback arguments (aside from userdata)
View gist:536043908532c3e584eabf3c0eccbf6f
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gdb
import operator
cs_instances = []
# This module helps generate a complete log of the call stack of a breakpoint.
# It can also record the value of some variables.
View GryadkaCasRegister.tla
------------------------- MODULE GryadkaCasRegister -------------------------
EXTENDS Integers, Sequences, FiniteSets
\* Timestamps is the set of possible timestamps for operations to choose from.
\* Each operation uses a unique timestamp.
\* Values is the set of possible values to set the register to.
\* Acceptors is the set of nodes which act as acceptors in the paxos sense.
\* Quorums is the set of all possible quorums, typically simple majorities.
CONSTANTS Timestamps, Values, Acceptors, Quorums
bowlofstew /
Created Oct 29, 2018 — forked from MMcM/
FoundationDB SQL Layer Java Routine Example
package com.foundationdb.example;
public class TestJavaBasic
public static void addSub(int x, int y, int[] sum, int[] diff) {
sum[0] = x + y;
diff[0] = x - y;
bowlofstew / README
Created Sep 8, 2018 — forked from tedhagos/README
My Latex Book Template
# Workflow and tool chain for writing a book for PDF publishing
## Toolchain
1. Pandoc, install using the cabal installer, don't apt-get. On OSX, there is dmg, I think the dmg is best option for OSX, it is just too problematic to get 1.9.2 cabal using brew or macports. There was one option I tried and succeeded, that is to install the Haskell environment using a package installer, that contained the cabal installer. Then install pandoc using cabal. Don't forget that the executables are in ~/.cabal/bin, so you have to set the path
2. TexLive, get the full distribution. It will take sometime to download, so get some coffee and be prepared to waste time
3. A good texteditor. ia Writer on OSX, vi (all around). Recently though, TextMate 2.0 Alpha seems to be a pretty good editor of Markdown
bowlofstew /
Created Sep 7, 2018 — forked from 0XDE57/
Firefox about:config privacy settings


about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable.

I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".