Skip to content

Instantly share code, notes, and snippets.

View teologov's full-sized avatar

Andrey Teologov teologov

View GitHub Profile
// Require libraries
var os = require("os");
var fs = require("fs");
var readline = require("readline");
var cluster = require("cluster");
var express = require("express");
var site = express();
// Var up, bro
var i, read;
@teologov
teologov / .jshintrc
Created October 16, 2015 19:23 — forked from iliakan/.jshintrc
{
"maxerr": 25,
"latedef": "nofunc",
"browser": true,
"node": true, // for browserify require etc
"globals": ["$", "Prism", "describe", "it", "before", "after", "beforeEach", "afterEach"],
"indent": 2,
"camelcase": true,
"newcap": true,
"undef": true,
@teologov
teologov / nginx.conf
Created December 29, 2015 13:42 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@teologov
teologov / iterm2-solarized.md
Created February 21, 2016 09:37 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

@teologov
teologov / Enhance.js
Created October 18, 2016 16:09 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@teologov
teologov / Build.md
Created November 30, 2016 11:01 — forked from robertknight/Build.md
Minimal Webpack DllPlugin example

Compile with:

webpack --config vendor.webpack.config.js
webpack --config app.webpack.config.js

Use with the following index.html

@teologov
teologov / nodejs-cluster-zero-downtime.md
Created February 14, 2017 13:27 — forked from jedi4ever/nodejs-cluster-zero-downtime.md
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

public extension Int {
public var seconds: DispatchTimeInterval {
return DispatchTimeInterval.seconds(self)
}
public var second: DispatchTimeInterval {
return seconds
}
@teologov
teologov / gist:80db65e93ecdb2af4ff64dd88fa6667a
Created December 28, 2017 15:48 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@teologov
teologov / original_colors.lua
Created January 16, 2018 23:29 — forked from htoyryla/original_colors.lua
Use original colors in an image generated by fast-neural-style
-- this program takes an original image, such as a photo,
-- and a generated image, such as generated by jcjohnson/fast-neural-style
-- and copies the original colors to the generated image
-- like when using the original_colors param in jcjohnson/neural-style
--
-- by hannu töyrylä @htoyryla 30 oct 2016
--
require 'torch'
require 'image'