Skip to content

Instantly share code, notes, and snippets.

View uran1980's full-sized avatar

Ivan Yakovlev uran1980

View GitHub Profile
@uran1980
uran1980 / pub-sub.js
Created September 13, 2017 15:09 — forked from reu/pub-sub.js
node.js redis pub-sub example
var redis = require("redis")
, subscriber = redis.createClient()
, publisher = redis.createClient();
subscriber.on("message", function(channel, message) {
console.log("Message '" + message + "' on channel '" + channel + "' arrived!")
});
subscriber.subscribe("test");
@uran1980
uran1980 / SingletonEnforcer.js
Created July 24, 2017 20:47 — forked from dmnsgn/SingletonEnforcer.js
ES6 singleton pattern: use Symbol to ensure singularity
// http://stackoverflow.com/a/26227662/1527470
const singleton = Symbol();
const singletonEnforcer = Symbol();
class SingletonEnforcer {
constructor(enforcer) {
if (enforcer !== singletonEnforcer) {
throw new Error('Cannot construct singleton');
}
@uran1980
uran1980 / gist:6d090d01bb013883128395a0d2a2f14b
Created February 11, 2017 15:00 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@uran1980
uran1980 / sass-convert_from-sass-to-scss.sh
Last active September 21, 2018 19:12 — forked from atelierbram/sass-convert_from-sass-to-scss.sh
Convert .sass syntax to .scss in terminal
# http://blog.teamtreehouse.com/the-absolute-beginners-guide-to-sass
# Enter the folder you want to convert in your terminal and type in:
# ---------------------------------------------------------------------
# sudo apt get install ruby-sass
# ---------------------------------------------------------------------
sass-convert --from sass --to scss -R .
# where -R means recursively and . means the current directory.
/var/log/nginx_*.log {
daily
compress
delaycompress
rotate 2
missingok
nocreate
sharedscripts
postrotate
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
require 'rubygems'
require 'chef/encrypted_data_bag_item'
secret = Chef::EncryptedDataBagItem.load_secret('data_bag_key')
data = {"id" => "mysql", "root" => "some secret password"}
encrypted_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(data, secret)
FileUtils.mkpath('data_bags/passwords')
File.open('data_bags/passwords/mysql.json', 'w') do |f|
f.print encrypted_data.to_json
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
Installing Barracuda and Octopus
$ wget -q -U iCab http://files.aegir.cc/BOA.sh.txt
$ bash BOA.sh.txt
$ boa in-head public server.mydomain.org my@email o1
Now simply watch the progress and choose some platforms to include. Done!
And how to upgrade Barracuda and all Octopus instances?