Skip to content

Instantly share code, notes, and snippets.

@quynhethereal
quynhethereal / README.md
Created November 21, 2023 04:47 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@quynhethereal
quynhethereal / nginxproxy.md
Created November 21, 2023 03:26 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@quynhethereal
quynhethereal / file-size.pipe.ts
Created October 18, 2023 13:22 — forked from JonCatmull/file-size.pipe.ts
Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB
/**
* @license
* Copyright (c) 2019 Jonathan Catmull.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@quynhethereal
quynhethereal / gist:d98ee4ac478457ba400eb783ce9cb216
Created February 8, 2023 04:10 — forked from dvydra/gist:3422479
Click on filename in terminal and open file in rubymine
1) Install iTerm2, it's awesome.
2) locate your rubymine commandline integration thingy, it's usually `/usr/local/bin/mine`
3) Open iTerm2 preferences. Go to Profiles -> Default -> Advanced.
4) Select "Run command..." under Semantic History
5) Enter "/usr/local/bin/mine --line \2 \1" as the command
@quynhethereal
quynhethereal / readme.md
Created November 9, 2022 08:29 — forked from brauliodiez/readme.md
lodash/fp set and flow

lodash/fp - set / flow

In this gist we are going to learn about basic goodies that we get from the library lodash/fp (fp stands for functional programming, great for ensuring immutability).We'll learn just by doing (step by step guided sample + codepens).

We'll cover lodash set and flow functions

Steps

  • We'll use codepen as our playground, navigate to this page:
@quynhethereal
quynhethereal / collapsible_on_doc.html
Last active May 27, 2022 17:00
Render a collapsible on your Markdown file
<!-- add `open` attribute if you want your collapsible to be opened by default, omit if not -->
<details open><summary>My collapsible</summary>
<p>
<!-- It is possible to render markdown within HTML tag, but beware there should be spaces around it! -->
```json
your code here
```
</p>
@quynhethereal
quynhethereal / check_http_string.sh
Created April 22, 2022 04:34
Shell script to be used with circleCI to detect unsafe HTTP usage in PR
#!/bin/bash
echo '------Scanning for unsafe HTTP usage in Doc ------'
#Need to set this flag to return exit code 1 to CI, hence fail the step
set -e
git diff $CIRCLE_BRANCH master --name-only | while read FILE; do
#Skip check for this file, duh
if [[ "$FILE" == *"check_http_string.sh"* ]]; then
@quynhethereal
quynhethereal / gist:e9fe0983620e3ecc1ce92f5114145b14
Last active April 22, 2022 04:30
Git pre-commit script to scan for unsafe HTTP usage in PR
#!/bin/bash
#This script is used in .git/hooks/pre-commit file. If you run it from another folder, you may need
#add flag --relative to git diff line so that the output of git diff is correct.
echo '------Scanning for unsafe HTTP usage'
#git diff --cached --name-only will return the names of the changed files
git diff --cached --name-only| while read FILE; do
if [[ $(echo "$FILE") ]]; then