Skip to content

Instantly share code, notes, and snippets.

View konstantinzolotarev's full-sized avatar
🕶️
Working

Konstantin Zolotarev konstantinzolotarev

🕶️
Working
View GitHub Profile
@konstantinzolotarev
konstantinzolotarev / Symfony2PasswordEncode.js
Last active January 22, 2024 10:36
Function for node.js that will encrypt password exactly like Symfony2 PHP framework. So all passwords from Symfony2 will work in your node.js application
'use strict';
var crypto = require('crypto');
var _ = require('lodash');
/**
* Will encrypt password in Symfony2 way using a given salt.
*
* @param {string} password
* @param {string} salt
function summ_char (str1, str2) {
return '' + (parseInt(str1) + parseInt(str2));
}
function summ (str1, str2) {
var num1 = str1.split('');
var num2 = str2.split('');
var tmp1, tmp2;
var result = '';

Keybase proof

I hereby claim:

  • I am konstantinzolotarev on github.
  • I am konstantinzol (https://keybase.io/konstantinzol) on keybase.
  • I have a public key whose fingerprint is 1103 B2BC 0D5D 3C01 0AF5 75DB 6F38 EE15 CAFF 20EA

To claim this, I am signing this object:

set nocompatible " be iMproved, required
" backspace
set backspace=2
set modeline
set number
set expandtab
set tabstop=2
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
alias nt='npm test'
alias ntm='npm run mocha'
# ----------------------
# Git Aliases
# ----------------------
snippet us
'use strict'
endsnippet
snippet cl
console.log(${1})
endsnippet
snippet ccl
console.log('==============================')
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@konstantinzolotarev
konstantinzolotarev / delayed_job_rabbit.js
Created August 11, 2016 10:43
Delayed job with RabbitMQ and amqplib
'use strict'
const amq = require('amqplib')
const open = amq.connect('amqp://localhost')
const q = 'tasks'
open
.then(function(conn) {
return conn.createChannel();
@konstantinzolotarev
konstantinzolotarev / nginx_ws_support.config
Created November 17, 2016 13:39
Websocket server should listen port 8080. And ELB type should be `application ELB` NOT CLASSIC ONE !
files:
"/etc/nginx/conf.d/01_websockets.conf":
mode: "000644"
owner: root
group: root
content: |
upstream nodejs {
server 127.0.0.1:8081;
keepalive 256;
}