Skip to content

Instantly share code, notes, and snippets.

View buurzx's full-sized avatar
🎯
Focusing

Pavel Romanov buurzx

🎯
Focusing
  • Earth
View GitHub Profile
@buurzx
buurzx / copy.go
Created October 10, 2017 13:06 — forked from r0l1/copy.go
Copy a directory tree (preserving permissions) in Go.
// CopyFile copies the contents of the file named src to the file named
// by dst. The file will be created if it does not already exist. If the
// destination file exists, all it's contents will be replaced by the contents
// of the source file. The file mode will be copied from the source and
// the copied data is synced/flushed to stable storage.
func CopyFile(src, dst string) (err error) {
in, err := os.Open(src)
if err != nil {
return
@buurzx
buurzx / github pre-hook
Last active September 29, 2017 08:37 — forked from skanev/rubocop.rb
A Rubocop wrapper that checks only added/modified code
The intention of this guide is to add a git hook in order to run rubocop on any ruby application you want to force yourself to follow the rules.
First you need to run the following commands, under the rails project directory:
```
$ touch .git/hooks/pre-commit
$ chmod +x .git/hooks/pre-commit
```
Next add the following code into your `.git/hooks/pre-commit` file:
```bash
FROM debian:8.6
RUN apt-get update && \
apt-get install -y --no-install-recommends curl make && \
\
echo 'Setting up erlang related variables' && \
ERLANG_VERSION=19.1.3 && \
ERLANG_BASE=https://packages.erlang-solutions.com/erlang/esl-erlang && \
ERLANG_FLAVOUR=FLAVOUR_1_general && \
ERLANG_DEB=esl-erlang_$ERLANG_VERSION-1~debian~jessie_amd64.deb && \
@buurzx
buurzx / erlang-release-init.d.md
Created June 23, 2017 12:54 — forked from ostinelli/erlang-release-init.d.md
Erlang Release init.d script

Erlang Release init.d script

If you have packaged your application into a release generated with Rebar, you might want to have the following:

  • The release started on system boot.
  • The VM monitored and restarted it if it crashes.

Use HEART

HEART is the Heartbeat Monitoring of an Erlang Runtime System. The purpose of the heart port program is to check that the Erlang runtime system it is supervising is still running, so that if the VM crashes or becomes unresponsive, it is restarted.

@buurzx
buurzx / deploy.rb
Created June 20, 2017 20:02 — forked from noma4i/deploy.rb
Deploy Phoenix Elixir by mina
require 'mina/bundler'
require 'mina/git'
require 'mina/rbenv'
set :domain, 'your_domain.com'
set :deploy_to, '/home/deployer/app_name'
set :repository, 'git@github.com:user_name/app_name'
set :branch, ENV["brunch"] || 'master'
set :app_name, "app_name"
@buurzx
buurzx / site.conf
Created May 30, 2017 20:47 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
It's a set of scripts he created for that workflow.
But to answer your question:
$ git checkout -b myFeature dev
Creates MyFeature branch off dev. Do your work and then
$ git commit -am "Your message"
Now merge your changes to dev without a fast-forward
To change all the directories to 755 (drwxr-xr-x):
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
require 'service_client'
class Result < OpenStruct
attr_reader :response, :parsed_body
def initialize(response)
@response = response
@parsed_body = JSON.parse(response.body)
super(parsed_body) if parsed_body.is_a?(Hash)
@buurzx
buurzx / service_client.rb
Last active May 7, 2016 18:52
Name of service is changed to Service =)
module ServiceClient
class ArgumentError < ::ArgumentError; end
class ServiceClientError < StandardError; end
class ServiceServerError < ServiceClientError; end
class Base
require 'httparty'
BASE_URL = Rails.application.secrets.service['url']
HEADERS = {