Skip to content

Instantly share code, notes, and snippets.

View Steakeye's full-sized avatar

Andrew Keats Steakeye

View GitHub Profile
@Steakeye
Steakeye / firewall-enable-port.ps1
Last active September 24, 2024 18:42
Sharing WSL2 hosted server with host LAN
param(
[Parameter(Position=0,mandatory=$true)][String] $port
)
echo "Enabling port in firewall..."
echo "Port $port"
netsh advfirewall firewall add rule name="Open Port $port" dir=in action=allow protocol=TCP localport=$port
@Steakeye
Steakeye / enable-adb-port-for-wsl2.ps1
Last active October 1, 2024 08:33
Setup ADB on WSL and the Windows host so you can connect to the Android device from WSL
netsh advfirewall firewall add rule name="ADB WSL2: Open Port 5037" dir=in action=allow protocol=TCP localport=5037 remoteip=172.16.0.0/12 profile=domain,private
@Steakeye
Steakeye / System Design.md
Created June 1, 2023 14:51 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@Steakeye
Steakeye / system-design-cheat-sheat.md
Created June 1, 2023 14:50 — forked from krebernisak/system-design-cheat-sheat.md
System design cheat sheet - It can be used for interviews or assessments (forked from Nikolay Ashanin)

System design cheat sheet

It can be used for interviews or assessments.

1. Understand problem and scope:

  • Recognize stakeholders and prioritize them. Create RACI matrix
  • Understand business drivers of the project
  • Recognize end-users of the project and understand how they will use that system
  • Check functional requirements
  • Define external dependencies
  • Suggest additional features
  • Remove items that interviewer considers out of scope
@Steakeye
Steakeye / singleton-pattern.ts
Last active November 29, 2021 15:38
TypeScript singleton pattern
export const singleton = new (class Singleton {
constructor(p: string) {}
})('param');
@Steakeye
Steakeye / list-scripts.sh
Created July 22, 2021 13:32
Run a single line node command to get the scripts listed in package.json
#!/usr/bin/env bash
node -e "console.log(require(require.resolve('./package.json')).scripts)"
html-react-parser #parse strings to React elements
react-ga #Google Analytics for React
react-cookie-consent #cookie consent banner
const Units = {
one: 'I',
five: 'V',
ten: 'X',
fifty: 'L',
hundred: 'C',
fiveHundred: 'D',
thousand: 'M',
}
@Steakeye
Steakeye / fizzbuzz.js
Last active May 23, 2021 11:06
NodeJS FizzBuzz
'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
@Steakeye
Steakeye / sapper-setupTypeScript.js
Created September 5, 2020 17:33
Script derived from the svelte template to be used on the sapper template to convert the project to TypeScript
/** This script modifies the project to support TS code in .svelte files like:
<script lang="ts">
export let name: string;
</script>
As well as validating the code for CI.
*/
/** To work on this script: