Open ~/.bash_profile
in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"os" | |
"os/exec" | |
"strings" | |
) |
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |
{"lastUpload":"2018-04-09T08:39:39.707Z","extensionVersion":"v2.9.0"} |
my_list = [int(i) for i in input().split(' ')] # get items from input with spaces between | |
def find_integer_with_most_divisors(input_list): | |
num, div = 0, 0 # tmp | |
for item in my_list: # iterate list | |
div_count = 0 | |
for i in range(1, item + 1): # genrate numbers | |
if item % i == 0: # check divisor | |
div_count += 1 |
local function get_topic(context, payload) | |
local query = "SELECT * from game_topics WHERE id = $1" | |
local parameters = {payload.id} | |
local ok, rows = pcall(nk.sql_query, query, parameters) | |
if ok then | |
return { topic = rows[1] } | |
else | |
error(rows) | |
return { status = "error", error = rows} |
{{$equipment := .Equipment}} | |
{{ range $index, $element := .Equipment}} | |
{{if $index}},{{end}} | |
{{$element.Name}} | |
{{end}} | |
// or if it's an array | |
// then register a function using template.Funcs(templte.FuncMap{"Join", strings.Join}) | |
{{ Join .Array ", " }} |
-- create user | |
create user user; | |
-- check user | |
select user, host, password from mysql.user; | |
-- set password | |
use mysql; | |
update user set password=PASSWORD("secret") where User='user'; |
// https://github.com/heroku/heroku-buildpack-go#private-git-repos | |
// every period (.) must be replaced with underscore (_) | |
dokku config:set --global GO_GIT_CRED__<PROTOCOL>__<HOSTNAME>=<TOKEN> | |
// dokku config:set --global GO_GIT_CRED__HTTPS__GITHUB__COM=<TOKEN> | |
sudo systemctl edit docker | |
# add the following lines to opened file | |
[Service] | |
ExecStart= | |
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock | |
sudo systemctl daemon-reload | |
sudo systemctl restart docker |