Skip to content

Instantly share code, notes, and snippets.

View doncadavona's full-sized avatar
💭
Elegance, grandeur in code. Simplicity first.

Don Cadavona doncadavona

💭
Elegance, grandeur in code. Simplicity first.
View GitHub Profile
@doncadavona
doncadavona / 0_introduction.md
Created July 28, 2021 07:26 — forked from justinhartman/0_introduction.md
Setup Azure Ubuntu 18.04 LEMP VM

How To Install Nginx, MySQL, PHP, SFTP on an Ubuntu Azure Virtual Machine

This series of documents will configure and setup a Nginx, MySQL, and PHP (LEMP) server on a basic Standard B1s (1 vcpus, 1 GiB memory) Ubuntu 16.04 or 18.04 LTS Virtual Machine on Microsoft Azure.

This will also install other useful packages and configurations for SFTP and a fully automated SSL service using certbot for Let's Encrypt.

The B1s is Azure's entry level Linux VM and only comes with 1 GiB memory so

@doncadavona
doncadavona / weight-utility.php
Last active November 18, 2020 19:19 — forked from irazasyed/weight-utility.php
PHP: Utility function for getting random values with weighting.
<?php
/**
* Utility function for getting random values with weighting.
* Pass in an associative array, such as ['A'=> 5, 'B'=> 45, 'C'=> 50].
* An array like this means that "A" has a 5% chance of being selected, "B" 45%, and "C" 50%.
* The return value is the array key, A, B, or C in this case. Note that the values assigned
* do not have to be percentages. The values are simply relative to each other. If one value
* weight was 2, and the other weight of 1, the value with the weight of 2 has about a 66%
* chance of being selected. Also note that weights should be integers.
@doncadavona
doncadavona / Aes256CbcEncrypterApp.cs
Last active September 9, 2024 07:17
A sample C# class to encrypt and decrypt texts using the cipher AES-256-CBC used in Laravel.
using System;
using System.Text;
using System.Security.Cryptography;
using System.Web.Script.Serialization;
using System.Collections.Generic;
namespace Aes256CbcEncrypterApp
{
class MainClass
{
@doncadavona
doncadavona / Aes256CbcEncrypterApp.cs
Last active August 1, 2024 20:11
A sample C# class to encrypt and decrypt strings using the cipher AES-256-CBC used in Laravel.
using System;
using System.Text;
using System.Security.Cryptography;
using System.Web.Script.Serialization;
using System.Collections.Generic;
namespace Aes256CbcEncrypterApp {
class MainClass {
public static void Main(string[] args) {
Console.WriteLine("Hello, world!");