This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -Po '"'"version"'"\s*:\s*"\K([^"]*)' package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Management.Automation; | |
namespace ExecutePowershellCmdlet { | |
class Program { | |
using (PowerShell pshell = PowerShell.Create()) { | |
DateTime yesterday = DateTime.Today.AddDays(-1); | |
string date_string = "\"" + yesterday.ToString("MM"_ + "/" + yesterday.ToString("dd") + "/" + yesterday.ToString("yyyy") + "\""; // "MM/dd/yyyy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_VS_PROJECT_TOP_LEVEL_FOLDER="/e/dev/internal-apps" | |
# find all nested folders with a packages.config file (where the NuGet package references are stored) | |
# loop through the results | |
find ${1:-"${DEFAULT_VS_PROJECT_TOP_LEVEL_FOLDER}"} -name "packages.config" | while read -r filename ; do | |
echo | |
echo $(basename "$(dirname "$filename")") | |
cat "$filename" | grep "<package " | sed -n 's/.*id="\([^"]*\).*version="\([^"]*\).*/\1@\2/p' | sed 's/^/ |-/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_VS_PROJECT_TOP_LEVEL_FOLDER="/e/dev/internal-apps" | |
echo "Finding all projects using NuGet package for ${1}" | |
# find all nested folders with a packages.config file (where the NuGet package references are stored) | |
# loop through the results | |
find ${2:-"${DEFAULT_VS_PROJECT_TOP_LEVEL_FOLDER}"} -name "packages.config" -exec grep -l "${1}" {} \; | while read -r filename ; do | |
echo $(basename "$(dirname "$filename")") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# generate root CA key | |
echo "Generating root CA key" | |
openssl genrsa -aes256 -out rootca.key 2048 | |
# generate root CA certificate (20 years) | |
echo "Generating root CA certificate" | |
openssl req -new -x509 -key rootca.key -days 7304 -sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat log.log | grep '\[2016\-05' | cut -c 23- | sort | uniq -c | sort -rn > 2016-05_error_count.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Cleaning git merge conflict artifacts..." | |
find . -name "*.bak" | while read filename; do echo "Removing: $filename" && rm -rf "$filename"; done | |
echo -e "\n" | |
echo "Counting unreachable objects in git database..." | |
unreachable=$(git fsck --unreachable | wc -l) | |
echo "There are $unreachable unreachable objects." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Scenario: There should only exist one record for each distinct value for column A that has column B set to true. There can be any number of records for each distinct value for column A where column B is false. | |
-- i.e. there can be only one active record (column B true) for each distinct value of column A | |
DROP TABLE IF EXISTS test; | |
CREATE TABLE test ( | |
"a" CHARACTER VARYING(3) NOT NULL, | |
"b" BOOLEAN NOT NULL DEFAULT TRUE | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Bash lets you use CTRL+X CTRL+E to edit-and-execute a command | |
## This will allow you to set up VS Code as the editor for this (and other Bash edit functions) | |
echo "export VISUAL=\"code -n -w\"" >> ~/.bashrc | |
source ~/.bashrc | |
## Then when you're typing a long command and need to change something or otherwise want better | |
## editing control over a command, simply hit CTRL+X CTRL+E and edit the command, then save | |
## and exit VS Code and the command will execute | |
## For Sublime Text |