Skip to content

Instantly share code, notes, and snippets.

View alksily's full-sized avatar
🏠
Working from home

Aleksey Ilyin alksily

🏠
Working from home
View GitHub Profile
@alksily
alksily / README.md
Created November 10, 2019 11:50
How install push stream module for nginx on debian, ubuntu

Install NGINX with nginx-push-stream-module

Gist for Ubuntu and Debian users

Easy

nginx 1.16.1 + push stream module latest

apt-get update -y \
@alksily
alksily / Snowflake.php
Created March 1, 2019 12:27
Snowflake
<?php
define('EPOCH', 1414213562373);
define('NUMWORKERBITS', 10);
define('NUMSEQUENCEBITS', 12);
define('MAXWORKERID', (-1 ^ (-1 << NUMWORKERBITS)));
define('MAXSEQUENCE', (-1 ^ (-1 << NUMSEQUENCEBITS)));
class Snowflake
@alksily
alksily / main.java
Created March 1, 2019 12:27
Launch frame
float f = (float) (Runtime.getRuntime().maxMemory() / 1024L / 1024L);
if(f > MIN_HEAP){
LauncherFrame.main(args);
}else{
try{
ArrayList<String> localArrayList = new ArrayList<String>();
String str = TGMMain.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
@alksily
alksily / OperationSystem.java
Created March 1, 2019 12:26
Detect operation system
package ru.aengine.util;
public class OperationSystem {
public static OS getPlatform() {
String str = System.getProperty("os.name").toLowerCase();
if(str.contains("win")) return OS.WINDOWS;
if(str.contains("mac")) return OS.MACOS;
if(str.contains("solaris")) return OS.SOLARIS;
if(str.contains("sunos")) return OS.SOLARIS;
@alksily
alksily / NoiseGenerator.java
Last active November 11, 2024 13:50
Perlin Noise (1D, 2D, 3D noise generator)
package main.ru.aengine.noise;
import java.util.Random;
public class NoiseGenerator {
private double seed;
private long default_size;
private int[] p;
private int[] permutation;
@alksily
alksily / Logger.java
Created March 1, 2019 12:25
Logger.java
package ru.aengine.tgm.util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
/**
@alksily
alksily / StreamReader.java
Created March 1, 2019 12:25
Named Data Tags
package ru.aengine.ndt;
import java.io.*;
import java.util.*;
import java.util.zip.*;
/**
* Named Data Tags (NDT) - file format for save array map.
* StreamReader class for read data from *.ndt file;
*/
@alksily
alksily / bundle.js
Created March 1, 2019 12:24
App bundle.js
/**
* Copyright (c) 2017, AEngine Official
* MIT License
*
* Need: jQuery, Backbone & Lodash
*/
'use strict';
// App
let App = {};
@alksily
alksily / events.js
Created March 1, 2019 12:21
JS Events
/**
* Standalone extraction of Events, no external dependency required.
* Degrades nicely when underscore are already available in the current
* global context.
*
* Note that docs suggest to use underscore's `_.extend()` method to add Events
* support to some given object. A `mixin()` method has been added to the Events
* prototype to avoid using underscore for that sole purpose:
*
* var myEventEmitter = Events.mixin({});
@alksily
alksily / readme.md
Created March 1, 2019 12:20
Debian Nginx+PHP7+MySQL+Redis

Add additional repositories by edit file /etc/apt/sources.list for each link add contrib non-free after main

Update:
apt-get update

Optional:
apt-get install mc htop build-essential

Install one command line:
apt-get install nginx-extras php7.0-cli php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-sybase php7.0-mbstring php7.0-redis redis-server mysql-server mysql-client