Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ryan Wuster ryanhanwu

🎯
Focusing
View GitHub Profile
@ryanhanwu
ryanhanwu / Makefile
Created May 5, 2020 — forked from jonschlinkert/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
View Makefile
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
View programming-quotes.md
View index.js
const csv = require('csv-parser');
const fs = require('fs');
const endPoints = {}
console.log("digraph g{")
console.log("rankdir=LR;")
console.log("node [style=filled];")
fs.createReadStream('data.csv')
.pipe(csv())
.on('data', (row) => {
View setup.sh
## Update Hostname
```
sudo hostname YOUR_HOSTNAME
# UPDATE your hostname and change it to YOUR_HOSTNAME
vim /etc/hostname
# Update your hosts
echo "127.0.0.1 YOUR_HOSTNAME" >> /etc/hosts
@ryanhanwu
ryanhanwu / vpn.applescript
Created Jan 16, 2020
Apple script for automatically create VPN
View vpn.applescript
on create_vpn_service(vpn_name)
tell application "System Preferences"
reveal pane "com.apple.preference.network"
activate
tell application "System Events"
tell process "System Preferences"
tell window 1
click button 1 -- "Add Service"
@ryanhanwu
ryanhanwu / test.js
Created Jan 9, 2020
Promise + Async/Await Test1
View test.js
console.log(1);
(async () => {
const promiseF = new Promise((resolve, reject) => {
console.log(2)
setTimeout(()=>{
try {
console.log(3)
resolve()
console.log(4)
} catch (error) {
@ryanhanwu
ryanhanwu / test.js
Created Oct 31, 2019
how to load environment variable from dotenv with link break?
View test.js
// MY_KEY=test\ntest2\ntest3
JSON.parse(`"${process.env.MY_KEY}"`)
/*
test
test2
test3
*/
@ryanhanwu
ryanhanwu / Brewfile
Last active Oct 12, 2020
New Mac Setup Script 2019
View Brewfile
# Taps
tap 'caskroom/cask'
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
tap 'homebrew/bundle'
tap 'heroku/brew'
# Install CLI Tools
## Shell Utilities
brew 'coreutils'
@ryanhanwu
ryanhanwu / githistory.sh
Created Oct 1, 2019
Change git history names
View githistory.sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
@ryanhanwu
ryanhanwu / Dockerfile
Created Feb 26, 2019
muti-stage build for node+babel+docker
View Dockerfile
# common base image for development and production
FROM node:10.11.0-alpine AS base
WORKDIR /app
# dev image contains everything needed for testing, development and building
FROM base AS development
COPY package.json yarn.lock ./
# first set aside prod dependencies so we can copy in to the prod image
You can’t perform that action at this time.