Skip to content

Instantly share code, notes, and snippets.

View DanielSundberg's full-sized avatar

Daniel Sundberg DanielSundberg

  • Bromma, Stockholm, Sweden
View GitHub Profile
@DanielSundberg
DanielSundberg / .gitconfig
Last active May 26, 2020 07:49
Git config file (with pretty short log)
[alias]
co = checkout
br = branch
ci = commit
st = status
shortlog = log --pretty=oneline --abbrev-commit
alias = ! git config --get-regexp ^alias\\.
l = log --pretty=format:"%C(green)%h%x20%Creset%C(cyan)%<(16,trunc)%cr%C(yellow)%<(15,trunc)%an%Creset%C(red)%d%Creset%x20%<(75,trunc)%s"
l3 = l -3
l5 = l -5
@DanielSundberg
DanielSundberg / SqlExceptionBuilder.cs
Last active January 21, 2019 07:49
SqlExceptionBuilder - Helper class to create an SQLException for unit testing
//
// Helper class to create an SQLException for unit testing, see:
// https://stackoverflow.com/questions/11976996/moq-and-throwing-a-sqlexception
//
// Usage:
// var sqlException1 = new SqlExceptionBuilder()
// .WithErrorNumber(50000)
// .WithErrorMessage("Database exception occured...")
// .Build();
//
@DanielSundberg
DanielSundberg / RunCommandAndCountErrors.ps1
Created December 5, 2018 09:04
Powershell Run a Command And Count Errors
# Run command and count errors
# I use this to gather statistics about flaky tests:
#
# > RunCommandAndCountErrors "python -mpytest -ktest_some_flaky_test .\test_tests.py" 10
# ...
# ...
# Test 10, nofErrors: 3
# Nof test runs: 10, nof errors: 3
# > _
function RunCommandAndCountErrors($cmd, $reps)
// User settings
{
"workbench.colorTheme": "Visual Studio Light",
"editor.minimap.enabled": false,
"telemetry.enableTelemetry": false,
}
// Workspace settings
{
"python.unitTest.pyTestArgs": ["-p no:logging"],
"python.unitTest.pyTestEnabled": true
[pytest]
log_print = False
addopts = -p no:capture
@DanielSundberg
DanielSundberg / copy-images.ps1
Last active August 29, 2015 14:09
Script to copy images from memory card to folder on disk
Moved to https://github.com/DanielSundberg/CopyImages
@DanielSundberg
DanielSundberg / gist:a1f0895396ebd36bc497
Last active October 1, 2018 17:37
AutoHotkey script to fix gerrit download url:s for Powershell
; This script will take the url you get from
; the Gerrit download button and replace
; the unix command/line separator ('&&') with
; a ';' which is accepted as line break in
; PowerShell
;
; This works with Gerrit 2.9 on Windows/Firefox
; with Flash enabled
;
#Persistent
@DanielSundberg
DanielSundberg / RewriteGerritDownloadUrl.user.js
Last active August 29, 2015 14:04
Greasemonkey Script to rewrite gerrit download URL to a valid PowerShell command
// ==UserScript==
// @name Rewrite Gerrit download link
// @include http://*/gerrit/#/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 1
// @grant GM_addStyle
// ==/UserScript==
// This script will take the url you get from
@DanielSundberg
DanielSundberg / JiraCopyKeyAndSummary.user.js
Last active May 29, 2019 10:49
Greasemonkey script. In JIRA, insert a summary line next to the project/case number path. This is what I usually want to copy when composing a mail or a refer to a case.
// ==UserScript==
// @name JiraCopyKeyAndSummary
// @author Daniel Sundberg
// @namespace https://github.com/DanielSundberg
// @include https://jira.*/browse/*
// @version 0.2
// @grant GM.setClipboard
// ==/UserScript==
// v0.2 2019-05-29