Skip to content

Instantly share code, notes, and snippets.

View harrietty's full-sized avatar

Harriet harrietty

View GitHub Profile
harrietty /
Last active September 16, 2021 07:56
Why do we need to use HashRouter instead of BrowserRouter when hosting on S3?

Why do we need to use HashRouter instead of BrowserRouter when hosting on S3?

Remember, React is a SPA - Single Page Application

As we know, the main idea of React Applications is that they are single page. There is just ONE HTML file, and ONE JavaScript file (although we cound split it up - more on that another day). This means that we do not have different physical files for different pages in our Application. E.g. we do not have index.html for the homepage, about.html for the About page, blog.html for the blog page. This was one of the key differences we discovered when we started using React, as opposed to when we were just using HTML. With React, all the content and logic is written in JavaScript and injected into a single HTML page.

At the end of the day, when we bundle our development code, these are the files we get:

  • index.html
  • bundle.js
harrietty /
Last active April 2, 2024 10:49
Golang Regex Cheatsheet

Golang Regex Cheatsheet

Using the regexp package

Include in the imports:

import "regexp"
set -ex
# Critical
aws logs put-metric-filter \
--log-group-name ${GROUP_NAME} \
set -ex
# Error
aws cloudwatch put-metric-alarm \
--alarm-name "$ALARM_NAME_PREFIX Error Count" \
class FooSpec
def self.describe(message, &block)
puts message
FooSpec.class_eval &block
def self.context(message, &block)
puts message
FooSpec.class_eval &block
# A script that outputs each number from start to end
# -s 1 to start at one
# -e 20 to end at 20
# -b to count backwards
# final argument is prefix to all the numbers
# e.g. count -s 1 -e 20 -b NUM_

Update all extensions of a particular type of file


# changes the extension of all files matching a given extension


Here are some posible solutions with explanations for Bash Practice Exercises. They are not necessarily the only or the best solutions - there is a preference for using a series of simple commands piped to one another.

1. A program that tells you whether the argument is a file, directory or doesn't exist


# Using an error exit code to make sure the program does not continue.
# Exiting with anything other than 0 signifies an error.

Excersises for learning bash shell scripting

Part 1: Creating scripts and simple logic

1. Create a program that tells you whether the argument you give it is a file, a directory or does not exist.

Use: $ ./ foo


harrietty /
Last active November 2, 2018 16:42
Useful Bash commands

Useful Bash Commands


netstat | grep ssh (mac)

netstat -vanp --tcp | grep 8080 (CentOS)

kill -9 <PID>