Skip to content

Instantly share code, notes, and snippets.

View jonlabelle's full-sized avatar

Jon LaBelle jonlabelle

View GitHub Profile
@jonlabelle
jonlabelle / search.sh
Last active March 5, 2021 05:59
Bash script to search file contents (by file extension) for the specified search term. Uses grep under the hood.
#!/usr/bin/env bash
# shellcheck disable=SC2034,SC2086,SC2155,SC2001,SC2048
#
# Search file contents (by file extension) for the specified search term.
#
# grep options:
#
# -i Perform case insensitive matching.
# −r Recursively search subdirectories listed.
@jonlabelle
jonlabelle / clean_dotnet_build_files.sh
Last active October 14, 2023 22:02
Delete dotnet build dirs and files ('bin', 'obj', etc) recursively, starting from the current working directory.
#!/usr/bin/env bash
#
# Delete dotnet build dirs and files (e.g. 'bin', 'obj', etc...)
# recursively, starting from the current working directory (PWD).
#
# TODO:
# - Handle unknown options passed in as arguments
#
# Author: Jon LaBelle
@jonlabelle
jonlabelle / Settings.StyleCop
Last active February 26, 2021 10:46 — forked from sneal/Settings.StyleCop
StyleCop settings
<StyleCopSettings Version="105">
<GlobalSettings>
<CollectionProperty Name="RecognizedWords">
<Value>upsert</Value>
<Value>api</Value>
<Value>deserializer</Value>
<Value>deserializing</Value>
<Value>json</Value>
<Value>json:api</Value>
</CollectionProperty>
@jonlabelle
jonlabelle / relative_time.py
Last active November 23, 2019 17:45 — forked from zhangsen/relative_time.py
python-relative-time
from datetime import datetime, timedelta
def relative_time(date):
"""Take a datetime and return its "age" as a string.
The age can be in second, minute, hour, day, month or year. Only the
biggest unit is considered, e.g. if it's 2 days and 3 hours, "2 days" will
be returned.
@jonlabelle
jonlabelle / dotnetcheatsheet.md
Created July 23, 2018 19:50 — forked from nth-block/dotnetcheatsheet.md
Dotnet core Cheat Sheet
@jonlabelle
jonlabelle / nginx-combine-access-logs.sh
Last active June 5, 2022 22:33
Combine Nginx Access Log files into one file.
#!/usr/bin/env bash
set -e
##
# Combine all Nginx Access Log files, into one log file. Starting with the
# oldest log file(s) at the bottom, with the newest log file(s) on top.
#
# Useful for exporting into log analyzers, or bulk importing into tools like
# Splunk.
@jonlabelle
jonlabelle / npm_vs_yarn_command_translation_cheatsheet.md
Last active April 4, 2026 00:29
npm vs yarn command translation cheat sheet
@jonlabelle
jonlabelle / ConsolePortScanner.cs
Created July 1, 2017 20:09
Simple async C# Open Port Network Scanner
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Net.Sockets;
namespace ConsolePortScanner
{
class MainClass
@jonlabelle
jonlabelle / disable_macos_firewall_logging.md
Last active October 10, 2025 20:11
Disable macOS Firewall Logging
@jonlabelle
jonlabelle / crlf.py
Last active November 11, 2025 22:39
Replace CRLF (windows) line endings with LF (unix) line endings in files.
#!/usr/bin/env python
"""Replace line breaks, from one format to another."""
from __future__ import print_function
import argparse
import glob
import os
import sys