Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@jbutko
jbutko / readme.MD
Last active April 14, 2017 21:24
NPM package publishing

login with username/password

npm login

publish

npm publish

for mongoose plugins add tag

npm dist-tag add [email protected] mongoose

publish new version

@jbutko
jbutko / script.sh
Created January 19, 2017 07:34
AngularJS HTML5 mode / Apache config
# https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode
<VirtualHost *:80>
ServerName my-app
DocumentRoot /path/to/app
<Directory /path/to/app>
RewriteEngine on
# Don't rewrite files or directories
@jbutko
jbutko / script.sh
Created January 11, 2017 08:50
Configure socket.io on apache server through https
# https://github.com/socketio/socket.io/issues/1942#issuecomment-204335448
ProxyPass / http://localhost:3999/
ProxyPassReverse / http://localhost:3999/
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://localhost:3999%{REQUEST_URI} [P]
@jbutko
jbutko / validate.js
Created December 5, 2016 10:18
Custom express validators via express-validator
// http://stackoverflow.com/questions/37339479/express-validator-to-validate-paramenter-which-is-an-array#answer-37342458
var expressValidator = require('express-validator');
var validator = require('validator');
app.use(expressValidator({
customValidators: {
isArray: function(value) {
return Array.isArray(value);
},
notEmpty: function(array) {
@jbutko
jbutko / bash.sh
Created November 11, 2016 06:31
Nginx
# upgrade nginx
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
# cache
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
@jbutko
jbutko / bash.sh
Last active May 8, 2024 13:50
Unix commands
# 10 biggest files
sudo du -a /var | sort -n -r | head -n 10
# check available space
df -h
# check biggest folders/directories in GB
du -hsx * | sort -rh | head -10
# create user and assign password
@jbutko
jbutko / pms-development.sh
Created October 22, 2016 14:33 — forked from mrister/pms-development.sh
pm2 example
#!/usr/bin/env bash
#install pm2
npm i pm2
#run with process.json configuration file for development environment
pm2 start process.json --env development
# delete it all
# pm2 delete process.json
@jbutko
jbutko / commands
Last active August 12, 2016 05:53 — forked from Savjee/commands
Jenkins-install-commands
# Install JRE & JDK
sudo apt-get install openjdk-7-jre
sudo apt-get install openjdk-7-jdk
# Download the security key for the Jenkins repository
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
# Add the key to the trusted keys for apt-get
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
@jbutko
jbutko / .gitconfig
Last active September 23, 2016 12:05
My .gitconfig #git
[alias]
s = status
st = status --short --branch
b = branch
c = checkout
cb = "git checkout -b"
d = diff
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ld = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
@jbutko
jbutko / scipt.js
Last active January 15, 2016 13:24
#JS, #MongoDB Cheat Sheet
/**
* mongodb cheat sheet
*/
// create db
use tasks
// list dbs
show dbs