Skip to content

Instantly share code, notes, and snippets.

@sevennt
sevennt / MySQL_5-7_macOS.md
Created December 13, 2019 06:09 — forked from robhrt7/MySQL_5-7_macOS.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.
@sevennt
sevennt / dial-mysql-via-ssh.go
Created March 19, 2019 17:32 — forked from vinzenz/dial-mysql-via-ssh.go
Using MySQL / MariaDB via SSH in Golang
package main
import (
"database/sql"
"fmt"
"net"
"os"
"github.com/go-sql-driver/mysql"
"golang.org/x/crypto/ssh"
@sevennt
sevennt / get_latest_release.sh
Created December 4, 2018 09:10 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
* * * * * (/bin/date && cd /home/www/satisfy. example.com && php bin/satis build satis.json repo) >> /home/www/satisfy. example.com/crontab.log 2>&1
server {
listen 80;
server_name satisfy. example.com;
index index.php index.html;
root /home/www/satisfy. example.com/web/;
access_log /var/log/nginx/satisfy. example.com.log;
error_log /var/log/nginx/satisfy. example.com.error.log error;
rewrite_log on;
location / {
@sevennt
sevennt / NginxRedirect.md
Created September 10, 2018 02:49 — forked from EmranAhmed/NginxRedirect.md
NGINX Redirect, Rewrite

Redirect: Temporary and Permanent

Source

What is an HTTP Redirect?

HTTP redirection, or URL redirection, is a technique of pointing one domain or address to another. There are many uses for redirection, and a few different kinds of redirection to consider.

As you create content and administrate servers, you will often find the need to redirect traffic from one place to another. This guide will discuss the different use-cases for these techniques, and how to accomplish them in Apache and Nginx.

@sevennt
sevennt / gen-license.sh
Created August 20, 2018 03:29
add LICENSE description to file header
#!/bin/bash
# ./license.sh src/api
# ./license.sh src/ui/src
if [[ $1 -eq "" ]]; then
echo "empty schema"
exit 1
fi
@sevennt
sevennt / watchers.xml
Last active August 20, 2018 03:28
Goland file watchers
<TaskOptions>
<TaskOptions>
<option name="arguments" value="fmt $FilePath$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="go" />
<option name="immediateSync" value="false" />
<option name="name" value="go fmt" />
<option name="output" value="$FilePath$" />
// TaskTmplVarConfirmSeqs returns tasktmpl confirm sequences.
func TaskTmplVarConfirmSeqs(tasktmpl TaskTmpl) (c []ConfirmItem, e error) {
c = append(c, ConfirmItem{Type: "string", Val: "Task executes success!"})
if tasktmpl.VarConfirm == "" {
return c, nil
}
t, e := template.New(tasktmpl.Name).Parse(tasktmpl.VarConfirm)
if e != nil {
log.Info("[model] TaskTmplVarConfirmSeqs template parse fail", "err", e)
@sevennt
sevennt / ssh_config
Created April 20, 2018 01:52 — forked from rbenaley/ssh_config
GitHub ssh access via HTTP Proxy
host github.com
user git
hostname ssh.github.com
port 443
proxycommand socat - PROXY:<hostname>:%h:%p,proxyport=<port>