Skip to content

Instantly share code, notes, and snippets.

View stephengfriend's full-sized avatar
🏋️‍♀️
Grindin'

Stephen G. Friend stephengfriend

🏋️‍♀️
Grindin'
View GitHub Profile
@stephengfriend
stephengfriend / index.js
Last active November 1, 2020 04:01
Simple Search Solutions
// Sample code to perform I/O:
process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";
process.stdin.on("data", function (input) {
stdin_input += input; // Reading input from STDIN
});
@stephengfriend
stephengfriend / filter.js
Created July 15, 2020 18:45
Simple comparison of omit and pick patterns for performance curiosity
const assert = require('assert');
function fnc() {
assert.deepEqual(arguments?.[0], { 'c': 3 })
assert.deepEqual(arguments?.[1], { 'a': 1, 'b': '2' })
assert.ok(arguments?.[2] === 3, '!= 3')
assert.ok(arguments?.[3] === 5, '!= 5')
}
const object = { 'a': 1, 'b': '2', 'c': 3 };
const quotes = [
{
quote:"Every person who wins in any undertaking must be willing to cut all sources of retreat. Only by doing so can one be sure of maintaining that state of mind known as a burning desire to win - essential to success.",
source:"Napoleon Hill",
citation: "Brainyquote",
year: 2020
},
{
quote:"Fear is the main source of superstition, and one of the main sources of cruelty. To conquer fear is the beginning of wisdom.",
@stephengfriend
stephengfriend / index.js
Created May 11, 2020 13:01
Monk Takes a Walk
// Sample code to perform I/O:
process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";
process.stdin.on("data", function (input) {
stdin_input += input; // Reading input from STDIN
});
process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";
process.stdin.on("data", function (input) {
stdin_input += input; // Reading input from STDIN
});
process.stdin.on("end", function () {
main(stdin_input); // Execute our entrypoint when we've finished reading the input
@stephengfriend
stephengfriend / disable.sh
Created March 12, 2020 22:35
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents

Disable Device Enrollment Program (DEP) notification on macOS Catalina.md

  1. Boot to Recovery Mode by holding command-R during restart

  2. Open Tools → Terminal and type

$ csrutil disable
$ reboot

SSH into AWS ec2/ Digitalocean droplet/ or else other PAAS, linux machine

  1. Install Docker
$sudo apt install docker.io
$sudo usermod -aG docker $USER

I already installed docker

@stephengfriend
stephengfriend / tmux.sh
Last active April 21, 2022 08:30
Visual Studio Code + tmux session integration
# Auto Start Tmux (must be last)
if [[ -z "$TMUX" ]] then
tmux_session='default'
terminal_slug="`echo $TERM_PROGRAM | iconv -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9-]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z | head -c 7`"
if [[ $TERM_PROGRAM == 'vscode' ]]; then
tmux_session="$terminal_slug-`pwd | sha1sum | head -c 8`"
fi
tmux new-session -A -d -s "$tmux_session"
@stephengfriend
stephengfriend / blog-post-preview-grid.js
Created January 16, 2020 19:29
Example linaria + tailwind
import {Link} from 'gatsby'
import {cx, css} from 'linaria'
import React from 'react'
import BlogPostPreview from './blog-post-preview'
const grid = css`
display: grid;
grid-template-columns: 1fr;
grid-column-gap: 2em;
grid-row-gap: 2em;