Skip to content

Instantly share code, notes, and snippets.

@jezhalford
jezhalford / cause-deadlock.php
Created August 6, 2015 13:42
Cause a MySQL Deadlock
<?php
/*
SQL -
CREATE TABLE innodb_deadlock_maker(a int primary key) engine=innodb;
*/
$dbA = new DB(); // Get two instances of whatever class you use to handle DB connections
$dbB = new DB(); // and do any initialisation you need
$dbA->connect(); // and open two separate connections
@jezhalford
jezhalford / sonar-csv.js
Last active December 11, 2015 11:56
Here's an easy to use tool that downloads issues from SonarQube and outputs them in CSV format
#!/usr/bin/env node
/*
* Downloads open issues from SonarQube and outputs them as a CSV file
*/
var request = require("request");
var json2csv = require("json2csv");
var util = require("util");
@jezhalford
jezhalford / grafana-text-panel-api.html
Last active March 11, 2018 21:49
Display API results in a grafana text panel
<!--
Heavily based on https://github.com/grafana/grafana/issues/1816#issuecomment-137827966,
with some simplification and modifications for newer version of Grafana
-->
<div>
<script type="text/javascript">
(function() {
// get a reference to the result container (this is a div at the bottom of this script)
var elem = $('#myPanel')
@jezhalford
jezhalford / gist:dd4c7e99e068ddfdc352dd1a7a7afaf9
Created January 23, 2019 11:44
indent-rainbow colours for grey indent shading in VSCode
{
"indentRainbow.colors": [
"rgba(16,16,16,0.2)",
"rgba(32,32,32,0.2)",
"rgba(48,48,48,0.2)",
"rgba(64,64,64,0.2)",
"rgba(80,80,80,0.2)",
"rgba(96,96,96,0.2)",
"rgba(112,112,112,0.2)",
"rgba(128,128,128,0.2)",