Skip to content

Instantly share code, notes, and snippets.

View navix's full-sized avatar
❄️
Coding smart ;)

Oleksa Novyk navix

❄️
Coding smart ;)
View GitHub Profile
@navix
navix / auto_restart_webserver.sh
Last active September 10, 2015 05:03 — forked from xi4oh4o/auto_restart_webserver.sh
Auto restart phpfpm on 502 & 504 Error also save logs
#!/bin/bash
MY_URL="http://moefou.org" #change you website
RESULT_502=`curl -I $MY_URL|grep "HTTP/1.1 502"`
RESULT_504=`curl -I $MY_URL|grep "HTTP/1.1 504"`
if [ -n "$RESULT_502" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "502 Bad Gateway">>/data/logs/web_error.log
elif [ -n "$RESULT_504" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "504 Gateway Time-out">>/data/logs/web_error.log
@navix
navix / color_luminance.php
Created February 2, 2016 13:22 — forked from stephenharris/color_luminance.php
Lighten or darken a given colour
<?php
/**
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7
* @param str $hex Colour as hexadecimal (with or without hash);
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() )
* @return str Lightened/Darkend colour as hexadecimal (with hash);
*/
function color_luminance( $hex, $percent ) {
// validate hex string
@navix
navix / auth-menu.less
Created January 10, 2016 20:17
Responsive by rscss
.auth-menu {
display: flex;
flex-direction: column;
...
}
@media (max-width: @tabletWidth) {
.auth-menu {
flex-direction: row-reverse;
flex-wrap: wrap;
@navix
navix / repo_install.sh
Last active September 17, 2016 09:39
Install npm package from repository
npm install git+https://Navix@bitbucket.org/jetqa/shedjs.git --save
@navix
navix / nodejs_path_fix.sh
Created September 17, 2016 10:00
Node.js after install path-fix
echo 'export PATH=$PATH:/usr/local/bin' >> $HOME/.bashrc
@navix
navix / nodejs_update.sh
Created September 17, 2016 10:03
Update Nodejs to latests
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node
@navix
navix / pg_dump.sh
Created September 17, 2016 12:26
PostgreSQL DB dump
pg_dump -h 127.0.0.1 --username=<USERNAME> -W <DBNAME> > <FILENAME>.psql
@navix
navix / letsencrypt_gen.sh
Created September 17, 2016 12:28
Let's Encrypt certificates generation
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto certonly --webroot -w <PUBLIC_PATH> -d <DOMAIN> -d <DOMAIN_ALI>
@navix
navix / self_ssl.sh
Created September 17, 2016 12:30
Self signed SSL certificates
openssl genrsa -out server.key 4096
openssl req -new -sha256 -key server.key -out server.csr
openssl x509 -req -days 3650 -sha256 -in server.csr -signkey server.key -out server.crt
@navix
navix / firefox_cache.md
Created September 17, 2016 12:35
Disable Firefox disk cache
about:config
browser.cache.disk.enable = false
browser.cache.memory.enable = true
browser.cache.memory.capacity = -1