Skip to content

Instantly share code, notes, and snippets.

@therightstuff
therightstuff / .netrc
Created July 28, 2020 16:45
Private PyPI repository access configurations
machine hostname.com
login USERNAME
password UNENCODED_PASSWORD
@therightstuff
therightstuff / Program.cs
Created November 19, 2017 15:34
‘How to create an Azure SQL Database programmatically’ with less frustration
/****************************** Module Header ******************************\
* DOWNLOADED FROM https://code.msdn.microsoft.com/How-to-create-an-Azure-SQL-dbd0bf6a
* Modified By: Adam Fisher (https://github.com/therightstuff)
* Module Name: Program.cs
* Project: CSCreateAzureSQL
* Copyright (c) Microsoft Corporation.
*
* This sample will show how to create a SQL database on Microsoft Azure
* using C#
*
@therightstuff
therightstuff / nugetimport.sh
Last active December 10, 2020 22:46
Batch / bulk upload script for NuGet private repo hosted on Nexus
#!/bin/bash
# to be run with git-bash on a Windows machine
# based on https://github.com/sonatype-nexus-community/nexus-repository-import-scripts/blob/master/nugetimport.sh
# download latest version of nuget.exe for Windows x86 Commandline
# from https://www.nuget.org/downloads into the current directory
# retrieve NuGet API Key from Nexus by clicking on your profile,
# the side bar menu should show "NuGet API Key"
show_usage() {
@therightstuff
therightstuff / simple_password_generator.py
Last active February 19, 2021 12:47
Generate a secure python password with no dependencies
"""
A simple password generator that produces secure passwords of a given length
without requiring the installation of additional modules.
The four valid password characters classes - lowercase, uppercase, digits and
punctuation - are inserted randomly into the password using cryptographically
strong random numbers from the secrets module until the password length
requirement is met, ensuring that each of the classes is included in the password.
Password strength verified with https://www.security.org/how-secure-is-my-password/
@therightstuff
therightstuff / BasicKeyVaultAuthentication.cs
Last active March 7, 2021 19:15
C# Azure Key Vault authentication using a service principal secret
// SEE http://www.industrialcuriosity.com/2018/03/azure-key-vault-in-c-for-dummies.html FOR FULL EXPLANATION
/// <summary>
/// Gets the access token
/// The parameters will be provided automatically, you don't need to understand them
/// </summary>
/// <param name="authority"> Authority </param>
/// <param name="resource"> Resource </param>
/// <param name="scope"> scope </param>
/// <returns> token </returns>
@therightstuff
therightstuff / atomic_write.py
Last active April 12, 2021 09:51
Safe atomic file writes for JSON and YAML in Python 3
import json
import os
import shutil
import stat
import tempfile
import yaml
def copy_with_metadata(source, target):
"""Copy file with all its permissions and metadata.
@therightstuff
therightstuff / README.md
Created July 10, 2021 09:05
Node.js script to convert FNB Credit Card statements from PDF to CSV

Convert PDF FNB Credit Card statements to CSV compatible with cheque account CSV format

A quick-hack node.js script that converts FNB (First Nation Bank of South Africa) PDF Credit Card statements to a CSV format that's similar enough to the format of their cheque account CSVs to enable the budgie-feeder parser to ingest it.

NOTE: results may vary, generated CSV files must be reviewed before use.

@therightstuff
therightstuff / README.md
Created October 3, 2021 10:35
Bamboo YAML Specs Tips and Tricks
@therightstuff
therightstuff / create_db.js
Created September 23, 2019 08:56
@mysql/xdevapi node.js example: (re)create mysql database, test table insert, select and delete
// https://dev.mysql.com/doc/x-devapi-userguide/en/devapi-users-introduction.html
var mysqlx = require('@mysql/xdevapi');
const MIGRATIONS_USER = 'migrationsuser';
var server = {
host : 'localhost',
user : 'intendeduser',
database : 'mydatabase',
password : 'mypassword'
@therightstuff
therightstuff / README.md
Created February 20, 2022 08:58
Fixing polyfill incompatibilities for webpack 5 in create-react-app

Fixing polyfill incompatibilities after upgrading to webpack 5 in create-react-app

After upgrading to the latest dependencies, I encountered the following errors:

'buffer' resolution

ERROR in ./node_modules/safe-buffer/index.js 2:13-30

Module not found: Error: Can't resolve 'buffer' in '/Users/geek.neo/propolis-portal/node_modules/safe-buffer'