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 July 29, 2024 10:49
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 February 16, 2024 17:17
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'