Skip to content

Instantly share code, notes, and snippets.

View shmdt's full-sized avatar
💭
🇺🇦

Kovalenko Anton shmdt

💭
🇺🇦
View GitHub Profile
@shmdt
shmdt / Flow
Created February 9, 2018 13:15
Add subdomain to nginx and update with https
sudo certbot --authenticator webroot --installer nginx
select number
add webroot (path/to/app)
sudo service nginx restart
@shmdt
shmdt / gist:67229e42a6160c2c95ce336bf27b3625
Created September 14, 2017 12:21 — forked from i556/gist:1661623
Cross Domain iframe Resizing
http://mohumohu/parent.html
http://hogehoge.com/iframe.html
//parent.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@shmdt
shmdt / Gemfile
Last active June 19, 2017 09:15 — forked from ctalkington/Gemfile
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
@shmdt
shmdt / sinatra_render_html.rb
Created May 24, 2017 08:25 — forked from kinopyo/sinatra_render_html.rb
How to render static HTML files in Sinatra.
require 'sinatra'
get '/' do
File.read(File.join('public', 'index.html'))
# or
# send_file File.join(settings.public, 'index.html')
end
@shmdt
shmdt / sphinx-macosx.sh
Created April 14, 2017 07:41 — forked from ubermuda/sphinx-macosx.sh
Installing sphinxsearch on macosx
# first sphinx
brew install sphinx
# the formula does not install libsphinxclient :/
wget http://sphinxsearch.com/files/sphinx-2.0.4-release.tar.gz
tar xzf sphinx-2.0.4-release.tar.gz
cd sphinx-2.0.4-release/api/libsphinxclient/
CXXCPP="gcc -E" ./configure --prefix=/usr/local
make
make install
@shmdt
shmdt / database.yml.example mysql2
Created April 11, 2017 09:35 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
upstream puma_<%= fetch(:nginx_config_name) %> { <%
flags = 'fail_timeout=0'
@backends = [fetch(:puma_bind)].flatten.map do |m|
etype, address = /(tcp|unix|ssl):\/{1,2}(.+)/.match(m).captures
if etype =='unix'
"server #{etype}:#{address} #{fetch(:nginx_socket_flags)};"
else
"server #{address.gsub(/0\.0\.0\.0(.+)/, "127.0.0.1\\1")} #{fetch(:nginx_http_flags)};"
end
end
@shmdt
shmdt / 1 Gist conventions
Created March 24, 2017 07:49 — forked from PavloBezpalov/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
@shmdt
shmdt / pg_hba.conf
Last active March 24, 2017 07:43 — forked from slenderock/pg_hba.conf
# ubuntu: sudo nano /etc/postgresql/<< version >>/main/pg_hba.conf
# Позволяет любому пользователю локальной системы подключиться
# к любой базе данных, используя любое имя базы данных через
# доменные сокеты Unix (по умолчанию для локальных подключений).
#
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
# То же, но для локальных замкнутых подключений по TCP/IP.