jq is useful to slice, filter, map and transform structured json data.
brew install jq
"Bash script header template": { | |
"prefix": "bashhead", | |
"body": [ | |
"#!/usr/bin/env bash", | |
"#", | |
"# Desc: ${1:description}", | |
"#", | |
"# Version: ${2:versionNumber}", | |
"#", | |
"# Usage: ${3:ScriptName} [${4:options}] ${5:args}", |
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 }); | |
}); |
# ---------------------------------- | |
# 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' |
#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)|"} | |
#> |