Skip to content

Instantly share code, notes, and snippets.

@JaxxArmstrong
JaxxArmstrong / gist:4db9caddd56591090e9741572a7f5c79
Created April 13, 2019 21:18
VScode Bash script header template
"Bash script header template": {
"prefix": "bashhead",
"body": [
"#!/usr/bin/env bash",
"#",
"# Desc: ${1:description}",
"#",
"# Version: ${2:versionNumber}",
"#",
"# Usage: ${3:ScriptName} [${4:options}] ${5:args}",
@xelaz
xelaz / delete-chunks.js
Created August 22, 2018 07:30
Delete orphaned Chunks from Mongo GridFs
db.getCollection('fs.chunks').aggregate([
{ $lookup: { from: 'fs.files', localField: 'files_id', foreignField: '_id', as: 'file' } },
{ $unwind: { path:'$file', preserveNullAndEmptyArrays: true } },
{ $match: { file: { $exists: false } } },
{ $project: { _id: 1, files_id: 1 } },
]).forEach(function(chunk) {
printjson(chunk);
// db.getCollection('fs.chunks').remove({ _id: chunk._id });
});
@olih
olih / jq-cheetsheet.md
Last active May 1, 2025 21:51
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@jonsuh
jonsuh / .bash_profile
Last active January 20, 2025 10:27
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@guitarrapc
guitarrapc / Get-EtwTraceProvider.ps1
Last active March 26, 2025 00:38
ETW (Event Tracing for Windows) Providers and their GUIDs for Windows 10 x64
#Requires -RunAsAdministrator
#Requires -Version 5.0
# requires Windows 10
Get-EtwTraceProvider | Select-Object SessionName, Guid | sort SessionName
# as Markdown
<#
#Requires -RunAsAdministrator
$result = Get-EtwTraceProvider | sort SessionName
$result | %{"|Name|GUID|";"|----|----|";}{"|$($_.SessionName)|$($_.Guid)|"}
#>