Skip to content

Instantly share code, notes, and snippets.

View synsa's full-sized avatar

Steve Lang synsa

View GitHub Profile
@synsa
synsa / db.sh
Created April 8, 2019 22:39
Simple bash script to create database from command line
#!/bin/bash
# Bash script written by Saad Ismail - [email protected]
# If /root/.my.cnf exists then it won't ask for root password
if [ -f /root/.my.cnf ]; then
echo "Please enter the NAME of the new WordPress database! (example: database1)"
read dbname
echo "Please enter the WordPress database CHARACTER SET! (example: latin1, utf8, ...)"
read charset
echo "Creating new WordPress database..."
@synsa
synsa / mysql-create-db-user.sh
Created April 8, 2019 22:42
database creation script by magepycho
#!/bin/bash
#
# Script to create MySQL db + user
#
# @author Raj KB <[email protected]>
# @website http://www.magepsycho.com
# @version 0.1.0
################################################################################
@synsa
synsa / Capfile
Created April 28, 2019 08:24 — forked from mashihua/Capfile
Capistrano deploy script for node.js
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
load 'config/node'
@synsa
synsa / A Nuxt.js VPS production deployment.md
Created April 28, 2019 08:28 — forked from DreaMinder/A Nuxt.js VPS production deployment.md
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with [email protected]. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

directoryWalker: (dir, callback, maxLevels, currentLevel, fromRoot) ->
maxLevels: if 'number' is typeof maxLevels then maxLevels else 0
currentLevel: if 'number' is typeof currentLevel then currentLevel else 1
fromRoot: if 'string' is typeof fromRoot then fromRoot else ''
fs.readdir dir, (error, files) ->
if error then puts error.message
else files.forEach (file) ->
fs.stat path.join(dir, file), (error, stats) ->
return puts error.message if error
@synsa
synsa / browsersync-webpack.md
Created May 16, 2019 20:04 — forked from robinrendle/browsersync-webpack.md
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

@synsa
synsa / autocomplete.vue
Created May 31, 2019 19:56 — forked from sryabov/autocomplete.vue
vuetify autocomplete component example
<template>
<v-autocomplete
v-model="select"
:loading="loading"
:items="items"
:search-input.sync="search"
no-filter
hide-selected
clearable
return-object
@synsa
synsa / personal.rc
Created June 6, 2019 18:36 — forked from kitchen/personal.rc
sample mutt configuration
# me
set realname = "Jeremy Kitchen"
set from = "[email protected]"
set envelope_from = yes
# personal account info
set imap_user = "[email protected]"
set imap_pass = "REDACTED"
set folder = imaps://imap.gmail.com/
set smtp_url = smtps://[email protected]@smtp.gmail.com/
@synsa
synsa / git-aware-bash-prompt.md
Created June 28, 2019 21:57 — forked from eliotsykes/git-aware-bash-prompt.md
Git Aware Bash Prompt