Skip to content

Instantly share code, notes, and snippets.

@romainl
romainl / vanilla-linter.md
Last active April 20, 2025 07:00
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.

@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active May 1, 2025 14:42
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@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"
@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:
@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"
}
@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)
@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"
)
@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:

@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
@evenkiel
evenkiel / gist:a05d3dbdc29b17ac2284
Last active November 9, 2022 19:21
SQL Server Performance Troubleshooting - Class Notes Day 1

SQL Server Performance Tuning Class - Day 1

Denver 2015

Getting ready steps

  • Write down 3 biggest pain points
    • "IS" it the database that's slowing things down or environmental? Is perfmon the answer?
    • Deadlocks / locking. Should we be running in a differnet isolation mode?
    • Audit solution - triggers vs in-app, etc.
  • Gather SQL server stats
  • Gather Wait statistics