This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{$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 ", " }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2018-04-09T08:39:39.707Z","extensionVersion":"v2.9.0"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"os" | |
"os/exec" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
MAINTAINER Reza Morsali | |
# install dependencies | |
RUN apt-get update && apt-get install -y wget git autoconf build-essential gettext libgettextpo-dev libgeoip-dev libncursesw5-dev pkg-config libglib2.0 && git clone https://github.com/allinurl/goaccess.git && cd goaccess && autoreconf -fiv && ./configure --enable-geoip --enable-utf8 && make && make install && apt-get purge -y wget git autoconf build-essential libncursesw5-dev pkg-config && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* && cd .. && rm -rf goaccess | |
RUN mkdir -p /home/root/www | |
RUN touch /home/root/www/report.html |