Skip to content

Instantly share code, notes, and snippets.

@sevennt
sevennt / vimrc.local
Created October 25, 2016 07:25 — forked from mikehaertl/vimrc.local
A global vim configuration on Ubuntu that uses Vundle. Just put it in /etc/vim/vimrc.local and follow the instructions
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" /etc/vim/vimrc.local V1.1.5 2016-07-08 https://gist.github.com/mikehaertl/1612035
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" A Vundle based Vim configuration with globally shared plugins on Ubuntu.
"
" This is a Vundle based Vim setup that keeps all plugins in a global
" directory, namely /etc/vim/bundle. It's trimmed towards PHP development
" with Yii.
"
@sevennt
sevennt / CentOS
Created April 4, 2018 01:24 — forked from ihipop/CentOS
Openresty init.d script for CENTOS / DEBIAN / UBUNTU
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Openresty init.d script, put in /etc/init.d, chmod +x /etc/init.d/openresty
# For Debian, run: update-rc.d -f openresty defaults
# For CentOS, run: chkconfig --add openresty
#
### BEGIN INIT INFO
# Provides: openresty
# Required-Start: $all
@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>
// 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 / 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$" />
@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 / 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.

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 / {
* * * * * (/bin/date && cd /home/www/satisfy. example.com && php bin/satis build satis.json repo) >> /home/www/satisfy. example.com/crontab.log 2>&1
@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