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 / 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 / typings.sh
Last active September 19, 2016 08:42
Typings package install
node_modules/typings/dist/bin.js install bluebird --save
node_modules/typings/dist/bin.js install helmet --save --global --source dt
@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 / autofocus.ts
Created September 17, 2016 09:36
Angular 2 // Element autofocus
@Component({
selector: 'my-comp',
template: `
<input #myInput type="text" />
<div> Some other content </div>
`
})
export class MyComp implements AfterViewInit {
@ViewChild('myInput') input: ElementRef;
@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>