Skip to content

Instantly share code, notes, and snippets.

View alexgalkin's full-sized avatar

Alex Halkin alexgalkin

View GitHub Profile
@alexgalkin
alexgalkin / nginx_proxy_socket
Created May 14, 2024 20:41
Reverse proxy configuration for SocketIO server
location /ws/ {
proxy_pass http://localhost:9000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
@alexgalkin
alexgalkin / os_checkjs
Last active May 14, 2024 20:43
Node Check that it is not macOS
os.platform() !== "darwin"
// OR
process.platform !== 'darwin'
@alexgalkin
alexgalkin / gist:1b7f460f35b94b72c4d6f4215ab7b77f
Last active May 14, 2024 20:44
Git Export project to ZIP
git archive --format zip --output /tmp/dev-project.zip main
uglifyjs --compress --mangle toplevel=true -- bin/index.js
@alexgalkin
alexgalkin / node_healthy
Created February 4, 2019 10:30
Simple Node respone
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'application/json'});
res.write('{"healthy":true}');
res.end();
}).listen(3000);
@alexgalkin
alexgalkin / sublime-tips.txt
Last active April 17, 2018 22:46
Sublime Tips
RegExpt for getting String before the first comma
^([^,])+
... alternative approach (option with selecting all possible characters)
^[a-zA-Z0-9\s\-\(\)\_\<\>]+
... and before the first space
^([^\s])+
Regexp for removing blank lines

Docker for mail

mkdir -p config touch config/postfix-accounts.cf docker run --rm
-e MAIL_USER=alex@domain.com
-e MAIL_PASS=password1
-ti tvial/docker-mailserver:latest
/bin/sh -c 'echo "$MAIL_USER|$(doveadm pw -s SHA512-CRYPT -u $MAIL_USER -p $MAIL_PASS)"' >> config/postfix-accounts.cf

@alexgalkin
alexgalkin / haroopad_install.txt
Created February 3, 2017 10:06
haroopad install
change package.json
{
"name": "haroopad",
"version": "0.3.3",
"description": "Markdown Editor",
"main": "",
"homepage": "https://rhiokim.github.com/haroopad",
"repository": "git://github.com/rhiokim/haroopad.git",
"author": "rhio.kim@gmail.com",
@alexgalkin
alexgalkin / logstash_db_report_csv.conf
Last active January 13, 2017 20:12
Logstash config for parsing DB CSV reports
input {
file {
path => "/var/logs/csv/*.csv"
type => "csvdb"
start_position => "beginning"
}
}
filter {
if [message] =~ /^oid/ {
@alexgalkin
alexgalkin / rus-filenames-utf8-fix.md
Last active December 21, 2016 15:02
Fix UTF-8 encoding for couple special russian letters