Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active June 28, 2025 19:06
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@xmlking
xmlking / golang.md
Last active August 9, 2024 04:25
Setup golang environment on MacOS without admin privileges

GoLang

Guide to setup golang development environment on MacOS without admin privileges

you you have local homebrew, install GoLang with brew install go and skip to Project step

for complete project with VSCode settings, refer hello project

# Building FAT librares for XCode 10
set -e
# If we're already inside this script then die
if [ -n "$MULTIPLATFORM_BUILD_IN_PROGRESS" ]; then
exit 0
fi
export MULTIPLATFORM_BUILD_IN_PROGRESS=1
@bradtraversy
bradtraversy / docker-help.md
Last active June 3, 2025 21:01
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@robhrt7
robhrt7 / MySQL_5-7_macOS.md
Last active December 18, 2024 08:43 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@milkersarac
milkersarac / scriptAndroid.sh
Last active June 24, 2020 19:14
This script can be used for building multiple react-native apps from a single git repo.
#!/bin/bash
# MUSTAFA ILKER SARAC
# This script can be used for building multiple react-native apps from a single git repo.
# It needs master files for the default configurations.
# master files are generally the copy of the current config files of that git repo.
# If current state of the app changes i.e. adding new 3rd party components so package.json changes;
# then one should be responsible to reflect these changes to the master files to be synced with the current state of the repo.
# This script can be used to alter the current state, so that new apps could be generated with new names etc.
# scriptAndroid.sh
# "chmod +x ./scriptAndroid" to make script executable.
@dvwright
dvwright / api.go
Last active June 26, 2023 08:02
test api basic go-sqlmock ExpectQuery test pass one query param
package main
import (
"database/sql"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
"gopkg.in/gorp.v1"
"log"
"strconv"
)
@joshnuss
joshnuss / app.js
Last active February 18, 2025 15:49
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active February 9, 2025 02:05
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {