Skip to content

Instantly share code, notes, and snippets.

View peschkaj's full-sized avatar

Jeremiah Peschka peschkaj

View GitHub Profile

Keybase proof

I hereby claim:

  • I am peschkaj on github.
  • I am peschkaj (https://keybase.io/peschkaj) on keybase.
  • I have a public key whose fingerprint is FC22 6FC0 6E2F CBA7 2E59 1716 9BDB 3B7E 5BDC F2F8

To claim this, I am signing this object:

if [[ `uname` == 'Linux' ]]
then
export LINUX=1
export GNU_USERLAND=1
else
export LINUX=
fi
if [[ `uname` == 'Darwin' ]]
then
@peschkaj
peschkaj / fabulous-query.sql
Last active August 29, 2015 14:18
A faboulously awful query
IF OBJECT_ID('tempdb..#recent_votes') IS NOT NULL
TRUNCATE TABLE #recent_votes;
ELSE
CREATE TABLE #recent_votes (
PostId INT PRIMARY KEY,
UserId INT,
VoteWeight INT
);
IF OBJECT_ID('tempdb..#posts') IS NOT NULL
@peschkaj
peschkaj / fk.sql
Created May 22, 2015 16:04
Testing foreign key effects on insert performance
USE testkeys;
GO
CREATE TABLE parent (
id INT NOT NULL,
filler CHAR(96) DEFAULT (REPLICATE('A', 96))
);
ALTER TABLE dbo.parent
ADD CONSTRAINT ParentPK PRIMARY KEY CLUSTERED (id);
@peschkaj
peschkaj / sample-json.json
Last active October 11, 2015 17:45
Sample JSON from SQL Server 2016
{
"orders": [
{
"number": "SO43659",
"due_date": "2011-06-12T00:00:00",
"ship_date": "2011-06-07T00:00:00",
"po_number": "PO522145787",
"total_due": 23153.2339,
"freight": 616.0984,
"items": [
@peschkaj
peschkaj / converting-measurements.sql
Created November 9, 2015 15:28
Converting units with TSQL
IF OBJECT_ID('conversions') IS NOT NULL
DROP TABLE conversions;
IF OBJECT_ID('measurements') IS NOT NULL
DROP TABLE measurements;
CREATE TABLE conversions
(
convert_from INT,
convert_to INT,
CREATE TABLE conversion (
from VARCHAR(50) NOT NULL ,
to VARCHAR(50) NOT NULL ,
conversion_factor DECIMAL (38, 10) NOT NULL
) ;
ALTER TABLE conversion
ADD CONSTRAINT pk_conversion
PRIMARY KEY (from, to) ;
#[test]
fn telemetry_cleanup_removes_old_files() {
setup(&|config| {
expect_ok(config, &["rustup", "default", "stable"]);
expect_ok(config, &["rustup", "telemetry", "on"]);
expect_ok(config, &["rustc", "--version"]);
let telemetry_dir = config.rustupdir.join("telemetry");
utils::ensure_dir_exists("telemetry",
void get_user_action(char input[MAX_INPUT_LENGTH])
{
bool validInput = false;
do
{
cout << HAND_MSG << endl;
cin.get(input, MAX_INPUT_LENGTH, '\n');
cin.ignore(100, '\n');
s_to_lower(input);
try {
Get-command -Name "git" -ErrorAction Stop >$null
Import-Module -Name "posh-git" -ErrorAction Stop >$null
$gitStatus = $true
} catch {
Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder."
$gitStatus = $false
}
function checkGit($Path) {