Skip to content

Instantly share code, notes, and snippets.

View ssippe's full-sized avatar

Sam Sippe ssippe

  • Reckon
  • Gold Coast, Australia
View GitHub Profile
@ssippe
ssippe / Deploying on Amazon AWS (Free-Tier) with EC2, RDS & S3.md
Created February 28, 2017 10:07 — forked from pcm211/Deploying on Amazon AWS (Free-Tier) with EC2, RDS & S3.md
This Is a step by step way to deploy Sharetribe to Amazon AWS Free Tier in Development Mode (Not Production)

Prerequisites

  1. Have an AWS Account
  2. Spin up an EC2 Instance of Ubuntu Server and Make sure that your instance's security groups allow incoming connections on TCP ports 22 and 3000
  3. Use an Elastic IP to bind your Instance to it --- You would not be paying for this -- Till the time the EC2 Instance is running
  4. Add the IP Allocated to your A Record --- with your registrar
  5. Have a SSH Connection to your EC2 Instance with the Key Pairs
  6. Connect to the EC2 Instance

STEP 1 -- Setting up the Playground

@ssippe
ssippe / cartesianProduct.ts
Created April 20, 2017 00:33
Typescript Cartesian Product
const f = (a: any[], b: any[]): any[] =>
[].concat(...a.map(a2 => b.map(b2 => [].concat(a2, b2))));
export const cartesianProduct = (a: any[], b: any[], ...c: any[]) => {
if (!b || b.length === 0) {
return a;
}
const [b2, ...c2] = c;
const fab = f(a, b);
return cartesianProduct(fab, b2, c2);
@ssippe
ssippe / gist:8fc11c4d7e766e66f06db0431dba3f0a
Created December 2, 2017 11:21
jwt+rsa+dotnet with pem
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
@ssippe
ssippe / AwsFirewallHolePunch.cs
Last active December 23, 2022 03:29
awspunch
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using Amazon;
@ssippe
ssippe / UnitTest1.cs
Created September 28, 2018 05:32
json serialization and immuatability
using System;
using System.Diagnostics;
using Newtonsoft.Json;
using Shouldly;
using Xunit;
namespace json
{
public class UnitTest1
{
@ssippe
ssippe / FindRelativePathInAncestors.cs
Last active October 8, 2018 06:50
FindRelativePathInAncestors
/// <summary>
/// Search for relativePath with respect to (w.r.t.) the current directory and if it doesn't exist,
/// search w.r.t. the current parent directory, then the grandparent and so on until the path is found
/// or the root it hit. Works for files or directories.
/// </summary>
/// <returns></returns>
public static string FindRelativePathInAncestors(string relativePath, string startDirectory)
{
relativePath = relativePath.TrimStart(Path.DirectorySeparatorChar);
int level = 0;
@ssippe
ssippe / AggregateException.cs
Created October 30, 2018 05:21
AggregateException Pattern
public void ProcessList(List<Input> inputs)
{
var errors = new List<Exception>();
foreach (var input in inputs)
{
try
{
Process(input);
}
catch (Exception ex)
@ssippe
ssippe / SketchSystems.spec
Last active March 25, 2019 03:21
Quote Listing*
Quote Listing*
New Quote -> New Quote Wizard
Select Quote -> Estimation View Mode?
Search -> Quote Listing
Estimation View Mode?
is accepted? -> Accepted Quote
is created? -> Created Quote
else -> Draft Quote
@ssippe
ssippe / SketchSystems.spec
Last active May 7, 2019 09:24
Landing Page
Landing Page
Create Design -> Is Logged In For New Design?
Login -> Login Page
Create Account -> Create Account
Is Logged In For New Design?
yes? -> New Design
no? -> Login Page
Login Page
@ssippe
ssippe / mysqlForceDeadlock.sql
Created May 15, 2020 05:31
mysql force deadlock
-- replace:
-- `log` with any table
-- `id` with any index column on that table
-- 81272070 with an existing value in the index column
-- in connection #1
START transaction;
select * from log where id = 81272070 FOR UPDATE;
select sleep(40);
COMMIT;