Skip to content

Instantly share code, notes, and snippets.

@evenkiel
evenkiel / gist:e3c048a6046f6be96d88
Created February 10, 2015 23:30
SQL Server Performance Troubleshooting - Day 2 Notes

SQL Server Performance Tuning Class - Day 2

Denver 2015

Finding Queries and Bottlenecks

  • RECOMPILE hints will cause the sproc to not show up in the DMV (Dynamic Management Views)
  • DMVs and profiler will only catch perf issues for a window of time. They are passive tools that have to be running when the issue occurs
  • sp_Blitz will look across a wider window of time.
  • ClearTrace as scriptable (and more powerful) version of SQL Server Profiler.
  • Recommended practice is to create a Tools database to store scripts like ClearTrace and the BrentOzar scripts. May shops will not allow anything to be installed to master. Plus, master won't be restored typically during a rebuild
@kwmiebach
kwmiebach / pytest.md
Last active May 13, 2025 10:02 — forked from amatellanes/pytest.sh
pytest cheat sheet

Usage

(Create a symlink pytest for py.test)

pytest [options] [file_or_dir] [file_or_dir] ...

Help:

@mjohnsullivan
mjohnsullivan / parse_json.go
Created December 14, 2015 23:17
Parse JSON objects with arbitrary key names in Go using interfaces and type assertions
// Parsing arbitrary JSON using interfaces in Go
// Demonstrates how to parse JSON with abritrary key names
// See https://blog.golang.org/json-and-go for more info on generic JSON parsing
package main
import (
"encoding/json"
"fmt"
)
@MyITGuy
MyITGuy / Set-ExitCodeAndExit.ps1
Last active May 19, 2022 16:27
PowerShell: Set-ExitCodeAndExit (ReturnCode)
function Set-ExitCodeAndExit {
[CmdletBinding(SupportsShouldProcess=$True,DefaultParameterSetName="None")]
PARAM(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ParameterSetName="p1")]
[int]
$ExitCode
)
Write-Verbose "Setting ExitCode to $($ExitCode) and exiting..."
# When a PowerShell script is called from a batch file or Command Prompt, this line allows a return code back to the calling shell
$host.SetShouldExit($ExitCode)
@justincjahn
justincjahn / 10-cisco-elasticsearch.conf
Last active August 9, 2024 22:37
Logstash: Processing Cisco Logs
#
# INPUT - Logstash listens on port 8514 for these logs.
#
input {
udp {
port => "8514"
type => "syslog-cisco"
}
@dgmorales
dgmorales / Makefile
Last active October 9, 2024 09:53
Example Makefile for creating deb/rpm packages with jordansissel/fpm
# This is an example Makefile for quick package creation
#
# It uses FPM [1] to generate simple packages.
# - If you need more features or a greater quality package, use debian
# standard tools for packaging.
# - Do not use checkinstall. Use FPM instead.
#
# [1] (https://github.com/jordansissel/fpm/wiki)
# IMPORTANT:
@EntropyWorks
EntropyWorks / add-ssh-keys.yml
Last active March 29, 2022 21:04
Add all the hosts from your ansible inventory to your .ssh/known_hosts and also use ssh-copy-id to add keys to the hosts
---
# Original idea found at http://stackoverflow.com/a/39083724
#
# ansible -i inventory.ini add-ssh-keys.yml
#
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active May 1, 2025 14:42
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@romainl
romainl / vanilla-linter.md
Last active June 10, 2025 22:19
Linting your code, the vanilla way

Linting your code, the vanilla way

You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.

Defining makeprg

autocmd FileType <filetype> setlocal makeprg=<external command>

This autocommand tells Vim to use <external command> when invoking :make % in a <filetype> buffer. You can add as many similar lines as needed for other languages.

@mcastelino
mcastelino / qemu_netdev_socket_vlan.md
Last active December 16, 2024 19:18
QEMU usermode virtual vlan using -netdev socket

Goal

How to launch multiple QEMU based VM's that can communicate with the outside world and between each other other without any setup on the host.

This uses two features available in qemu

  • User Mode Networking stack - SLIRP
  • Socket networking backend allows you to create a network of guests that can see each other

This allows us to have