Skip to content

Instantly share code, notes, and snippets.

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

Vyacheslav Voronchuk Voronchuk

🏠
Working from home
View GitHub Profile
const webpack = require('webpack');
const path = require('path');
const glob = require('glob');
const merge = require('webpack-merge');
const ClosurePlugin = require('closure-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
@Voronchuk
Voronchuk / riot-matrix-workshop.md
Created February 7, 2020 16:07 — forked from attacus/riot-matrix-workshop.md
Create your own encrypted chat server with Riot and Matrix

This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

@Voronchuk
Voronchuk / Dockerfile
Last active July 12, 2016 16:51
Phoenix 1.1.6 on Elixir 1.2.5 and OTP 18
FROM erlang:18
MAINTAINER Vyacheslav Voronchuk <voronchuk@gmail.com>
# elixir expects utf8.
ENV ELIXIR_VERSION="v1.2.5" \
LANG=C.UTF-8
RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/releases/download/${ELIXIR_VERSION}/Precompiled.zip" \
@Voronchuk
Voronchuk / deploy.sh
Created October 9, 2014 07:23
Sample script to deploy Meteor site from local machine to Ubuntu hosting
#! /bin/sh
# First argument is the name of .json file with settings for this site
export PROJECT_DIR=~/Dropbox/Projects/starbuildr
export PROJECT_NAME=starbuildr
export SERVER_DIR=/home/web/starbuildr
export SSH_HOST=$1
export SSH_USER=web
export SERVICE_NAME=$1
@Voronchuk
Voronchuk / start.sh
Created October 8, 2014 20:51
Shell script to start bundled Meteor.js application on Ubuntu
# This file can be used manually to start Meteor Node.js server, but it's also used by /etc/init/starbuildr.com daemon
export METEOR_PROJECT=starbuildr.com
export METEOR_DB_NAME=starbuildr_com
export METEOR_PROJECT_DIR=/home/web/starbuildr
export PORT=8090
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
# set to home directory of the user Meteor will be running as
@Voronchuk
Voronchuk / projectname.conf
Created October 8, 2014 20:45
Startup script for bundled Meteor.js application
description "Meteor.js (NodeJS) application"
author "Viacheslav Voronchuk <voronchuk@starbuildr.com>"
# When to start the service
start on started mongodb and runlevel [2345]
# When to stop the service
stop on shutdown
# Automatically restart process if crashed (we use forever for that)
# Previewer for image uploading
handleFileSelect = (evt) ->
files = evt.target.files
# Loop through the FileList and render image files as thumbnails.
for f in files
if !f.type.match 'image.*' then continue
output = $(evt.target).parent().siblings('output').find('.js-image-preview')
reader = new FileReader()
@Voronchuk
Voronchuk / gist:5284687
Last active December 15, 2015 15:49
WordCount string validator for Zend Framework 2 (based on Zend/Validator/File/WordCount).
<?php
/**
* WordCount validator for strings.
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2009-2013 Vyacheslav Voronchuk (http://www.wm-software.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Application\Validator;
@Voronchuk
Voronchuk / gist:4040476
Last active October 12, 2015 14:28
Websocket mixins for ExtJS 4 MVC
# Facade to work with "Gimite web socket" library
#
# Copyright (coffee) 2009-2012 [Vyacheslav Voronchuk](mailto:voronchuk@gmail.com), [Web management software](http://wm-software.com)
# License: see project's LICENSE file
# Date: 08.08.12
Ext.define 'SSP.view.mixin.Websockets'
# Websocket thread object
# * __var__ - WebSocket
ws: null
# Storage for Websocket listeners
@Voronchuk
Voronchuk / gist:3818221
Last active May 5, 2023 07:59
Recently one of my Wordpress blogs was hacked with eval(base64(....)); injection in all php files. Updating Wordpress fixed everything but "wp-content" folder, so I wrote a small script to clear all php files from this junk.
<?php
function clearjunk($file) {
$content = file_get_contents($file);
$content = preg_replace('/\s*eval\(base64_decode\("[^"]+"\)\);\s*/i', ' ', $content);
file_put_contents($file, $content);
}
function readfolder($dir)
{
if (is_dir($dir)) {