Skip to content

Instantly share code, notes, and snippets.

View peschkaj's full-sized avatar

Jeremiah Peschka peschkaj

View GitHub Profile
@peschkaj
peschkaj / match_queries_by_hash.sql
Created March 24, 2014 01:24
This will match SQL Server statements to the appropriate portion of the execution plan based on the query_plan_hash
SELECT QueryPlanHash,
CASE WHEN QueryType LIKE '%Stored Procedure%' THEN
QueryPlan.value('declare namespace p="http://schemas.microsoft.com/sqlserver/2004/07/showplan";
sum(//p:StmtSimple/@StatementSubTreeCost)', 'float')
ELSE
QueryPlan.value('declare namespace p="http://schemas.microsoft.com/sqlserver/2004/07/showplan";
sum(//p:StmtSimple[xs:hexBinary(substring(@QueryPlanHash, 3)) = xs:hexBinary(sql:column("QueryPlanHash"))]/@StatementSubTreeCost)', 'float')
END AS cost, *
FROM #procs
@timf
timf / gist:1718425
Created February 1, 2012 18:15
Throttling BW and latency on OSX
sudo ipfw pipe 1 config bw 150kbit/s delay 150ms
sudo ipfw add pipe 1 dst-ip 0.0.0.0/0
# do slow stuff
# done:
sudo ipfw flush
@jbtule
jbtule / LosslessJson.csx
Created May 25, 2013 01:37
This example was inspired by "Serialization is Lossy" http://kellabyte.com/2013/05/02/serialization-is-lossy/
using ImpromptuInterface;
using Newtonsoft.Json.Linq;
/*
* This example was inspired by
* "Serialization is Lossy"
* http://kellabyte.com/2013/05/02/serialization-is-lossy/
*/
#include <iostream>
using namespace std;
class Monster {
public:
Monster();
Monster(int initial_hp);
~Monster();
void attack() const;
@tjdett
tjdett / MyScalatraServlet.scala
Last active May 24, 2018 05:29
Scala + Apache POI to read uploaded Excel doc
package com.example.app
import org.scalatra._
import servlet.{SizeConstraintExceededException, FileUploadSupport}
import scalate.ScalateSupport
import java.io.ByteArrayInputStream
import org.apache.poi.ss.usermodel.WorkbookFactory
import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.DataFormatter
import org.apache.poi.ss.usermodel.DateUtil
@taddev
taddev / RunElevated.ps1
Created October 27, 2012 04:43
Create a sudo-like command for Powershell
#
# Author: Tad DeVries
# Email: taddevries@gmail.com
# FileName: RunElevated.ps1
#
# Description:
# Creates a "sudo" like command to elevate another
# command to administrative level. This is used to
# simplify the CLI interaction and create a little
# home like feeling for the *nix users out there.
@pbailis
pbailis / gist:5660980
Last active April 27, 2020 11:46
Assorted distributed database readings

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht

@bigsnarfdude
bigsnarfdude / gist:b2eb1cabfdaf7e62a8fc
Last active March 8, 2021 09:40
ubuntu 14.04 install scala 2.11.7 and sbt 13.9 and java 8 and git
# scala install
wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
# sbt installation
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
@binaerbaum
binaerbaum / arch-linux-install
Last active April 6, 2022 03:16 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swiss-french keymap