Skip to content

Instantly share code, notes, and snippets.

@asears
asears / bash_strict_mode.md
Created March 25, 2023 07:35 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@asears
asears / RUST.md
Last active March 25, 2023 15:51
Rust commands

rustc --version cargo --version

cargo install cargo-quickinstall

cargo quickinstall gitoxide

The default installation, 'max'

cargo install gitoxide

@asears
asears / spleet.cmd
Created September 27, 2022 16:13
Spleeter + Wav to MP3 Command File
@echo off
REM spleeter to convert to wav with 4 stems, convert to mp3 with minimal loss.
spleeter separate -p spleeter:4stems -o output %1
SET _file=%1
SET _folder=%_file:.mp3=%
SET _folder=%_folder:"=%
ECHO %_folder%
ffmpeg -vn -ar 44100 -ac 2 -b:a 192k "output\%_folder%\vocals.mp3" -i "output\%_folder%\vocals.wav"
ffmpeg -vn -ar 44100 -ac 2 -b:a 192k "output\%_folder%\bass.mp3" -i "output\%_folder%\bass.wav"
ffmpeg -vn -ar 44100 -ac 2 -b:a 192k "output\%_folder%\drums.mp3" -i "output\%_folder%\drums.wav"
@asears
asears / test.md
Last active September 21, 2022 11:35
Unit testing with Databricks

Unit Testing with Databricks

pytest-mock

sys.dont_write_bytecode = True # or set init script to allow writing to repo for pytest.
dbutils.library.restartPython() # to clear the interpreter before a test.

https://www.red-gate.com/simple-talk/blogs/sql-naming-conventions/

It helps greatly to start with a dictionary of the correct nouns and verbs associated with the application domain and use that.

If it proves inadequate, then the team can build on it.

If a data model has been created as part of the design phase, this dictionary should be an end-product of this work.

Don't tibble, no tbl_ or rpt_

@asears
asears / reserved_word_check.sql
Last active May 7, 2022 12:00
sql reserved words
SELECT name
FROM sys.objects
INNER JOIN
(
VALUES ('ADD'), ('EXTERNAL'), ('PROCEDURE'), ('ALL'), ('FETCH'),
('PUBLIC'), ('ALTER'), ('FILE'), ('RAISERROR'), ('AND'),
('FILLFACTOR'), ('READ'), ('ANY'), ('FOR'), ('READTEXT'), ('AS'),
('FOREIGN'), ('RECONFIGURE'), ('ASC'), ('FREETEXT'), ('REFERENCES'),
('AUTHORIZATION'), ('FREETEXTTABLE'), ('REPLICATION'), ('BACKUP'),
('FROM'), ('RESTORE'), ('BEGIN'), ('FULL'), ('RESTRICT'), ('BETWEEN'),
@asears
asears / Test-BicepFiles.ps1
Last active February 7, 2022 14:51
Test Bicep Files
# Get-ChildItem -Recurse -Filter "*.bicep" | foreach { Test-BicepFile -Path $_.fullname }
# https://github.com/Azure/bicep/issues/5828
$biceps = Get-ChildItem -Path . -Include "*.bicep" -r
$errors = 0
$numberOfFiles = $biceps.Length
foreach ($file in $biceps) {
@asears
asears / gitsetup.md
Created January 7, 2022 10:36
Git setup
# Global user
git config --global user.name "Firstname lastname"
git config --global user.email [email protected]
# Local user
git config user.name=<user name>
git config user.email=<email>

git config credential.helper store
@asears
asears / azuretemplate.md
Created January 4, 2022 15:35
Azure Templates and Patterns
@asears
asears / pytest.md
Created January 4, 2022 15:29
Pytests