Skip to content

Instantly share code, notes, and snippets.

View peterrudenko's full-sized avatar

Peter Rudenko peterrudenko

View GitHub Profile
@peterrudenko
peterrudenko / nginx-ws-tls-termination.conf
Created February 16, 2020 12:20 — forked from cantremember/nginx-ws-tls-termination.conf
Nginx as a TLS Termination proxy for WebSockets
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream server_cluster {
# sticky connections are critical for non-WebSocket Socket.io
# http://socket.io/docs/using-multiple-nodes/
ip_hash;
@peterrudenko
peterrudenko / translations.json
Created January 28, 2019 11:10
Helio user translations override example file
{
"translations": {
"locale": [
{
"id": "ru",
"name": "\u0420\u0443\u0441\u0441\u043a\u0438\u0439",
"pluralEquation": "({x}%10==1 && {x}%100!=11 ? 1 : {x}%10>=2 && {x}%10<=4 && ({x}%100<10 || {x}%100>=20) ? 2 : 3)",
"literal": [
{
"name": "key-of-yours",
namespace KeyboardFocusDebugger
{
// This will sort a set of components, so that they are ordered in terms of
// left-to-right and then top-to-bottom.
struct ScreenPositionComparator
{
static int compareElements(const Component* const first, const Component* const second)
{
const int explicitOrder1 = getOrder(first);
const int explicitOrder2 = getOrder(second);
@peterrudenko
peterrudenko / readme.md
Created January 13, 2018 11:34 — forked from bnhansn/readme.md
Ubuntu Elixir Distillery Deployment

Rough outline of setting up a Ubuntu server for deploying an Elixir app with Distillery.

ssh into server

ssh root@ip.address

update packages

@peterrudenko
peterrudenko / Phoenix JWT.md
Last active July 3, 2018 18:52 — forked from nikneroz/Phoenix JWT.md
Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin

Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin

User model bootstrap

Let's generate User model and controller.

mix ecto.create
mix phoenix.gen.json Accounts User users email:string password_hash:string
@peterrudenko
peterrudenko / up-and-running-with-edeliver-on-do.md
Created January 7, 2018 07:37 — forked from davoclavo/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new ubuntu droplet

Setup Server

@peterrudenko
peterrudenko / BinarySearch.h
Created November 28, 2017 10:14 — forked from adamski/BinarySearch.h
Binary Search functions for JUCE ValueTree and Array types
/*
==============================================================================
BinarySearch.h
Created: 31 Jul 2014 9:57:04am
Author: Adam Wilson
==============================================================================
*/
import sys
# A script to minify css based on Chrome's css audit -> needs a text file of unused selectors.
if len(sys.argv) < 3:
print("Usage: python ./truncate_css.py input.css unused.txt output.css")
quit()
reload(sys)
import os
import sys
import fnmatch
from tinypng import shrink_file
apiKey = "your key"
rootdir = sys.argv[1]
for root, dirs, files in os.walk(os.path.abspath(rootdir)):
@peterrudenko
peterrudenko / ScopedMemoryBlock.h
Created October 24, 2015 19:13
ScopedMemoryBlock
#ifndef SCOPEDMEMORYBLOCK_H_INCLUDED
#define SCOPEDMEMORYBLOCK_H_INCLUDED
template<typename T>
class ScopedMemoryBlock final
{
public:
ScopedMemoryBlock() noexcept : data(nullptr), size(0) {}