Skip to content

Instantly share code, notes, and snippets.

View gsong's full-sized avatar

George Song gsong

View GitHub Profile
@gsong
gsong / pyenv-setup.md
Last active September 11, 2018 06:44
Pyenv Setup Step-by-step
  1. Install [pyenv][] using [pyenv-installer][]:

    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
  2. Activate pyenv for Terminal:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
@gsong
gsong / machine.js
Last active March 3, 2020 12:13
Generated by XState Viz: https://xstate.js.org/viz
const form = {
initial: "editing",
states: {
editing: {
entry: "updateStatus",
on: {
CHANGE: { target: "editing", actions: ["edit"] },
RESET: { target: "editing", actions: ["reset"] },
SUBMIT: { target: "submitting", cond: "submitAllowed" },
},
@gsong
gsong / machine.js
Last active March 4, 2020 16:25
Generated by XState Viz: https://xstate.js.org/viz
const ALL = "All";
const fetchMachine = Machine(
{
id: "fetch",
initial: "loading",
context: { characters: [], filtered: [], genders: [], retries: 0 },
states: {
loading: {
@gsong
gsong / machine.js
Last active March 20, 2020 17:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@gsong
gsong / machine.js
Last active May 24, 2020 14:35
Generated by XState Viz: https://xstate.js.org/viz
const context = { useLoadingStatus: false };
const queryMachine = Machine(
{
id: "query",
context,
on: {
UPDATE: [
{ target: "loading", cond: "isLoading" },
{ target: "notFound", cond: "isNotFound" },
@gsong
gsong / project-planning.md
Last active April 6, 2021 20:01
Techtonica Project Planning

Planning Your Final Project

Elements of Your Final Project

README

Non-Technical

  • Link to demo app
  • Elevator pitch
@gsong
gsong / docker-compose.yml
Last active September 30, 2021 14:17
Docker compose file to start PG and PGAdmin
version: "3.8"
services:
pg:
image: postgres:alpine
container_name: dev-postgres
hostname: pg
environment:
POSTGRES_USER: me
POSTGRES_PASSWORD: password
@gsong
gsong / gist:6321633
Last active February 4, 2022 12:06
Bash script to generate SSL csr/key/crt
#!/bin/bash
# Usage:
#
# ssl_setup [--self] <name> <csr_config>
#
# This script is used to generate key and CSR for use HTTPS in Nginx.
#
# --self Generate self-signed certificate in addition to key and CSR.
# name Output files will be named as <name>.key and <name>.csr.