Skip to content

Instantly share code, notes, and snippets.

View marinsagovac's full-sized avatar

Marin Sagovac marinsagovac

View GitHub Profile
FF000000
FFFFFFFF
FFFF0000
FF00FF00
FF0000FF
FFFFFF00
FFFF00FF
FF00FFFF
FF800000
FF008000
# Allow a command to continue execution after logout
nohup mycommand &
# Display one particular line from a file
gzip -dc mytarball.tar.gz | tar xvf -
# Display current runlevel
who -r
# Split lines of text into n-char lines
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER="root"
PASSWORD="SnM1073k"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backups/files"
@marinsagovac
marinsagovac / PHP PCNTL fork process
Last active December 14, 2017 10:16
PCNTL fork process
<?php
$pid = pcntl_fork();
if ($pid == -1) {
die("could not fork");
} else if ($pid) {
exit(); // we are the parent
} else {
// we are the child
}
if (posix_setsid() == -1) {
@marinsagovac
marinsagovac / PHP CHARS ASCII
Last active December 14, 2017 10:16
Grim string to number
<?
$num_to_char = array(
'27' => "1",
'28' => "2",
'29' => "3",
'30' => "4",
'31' => "5",
'32' => "6",
'33' => "7",
'34' => "8",
@marinsagovac
marinsagovac / Ubuntu MongoDB install
Created December 15, 2017 10:49
Ubuntu MongoDB install
### Ubuntu Mongodb ###
### Installing Mongodb ###
sudo apt-get install mongodb-server
sudo service mongodb start
Check log in "/var/log/mongodb/mongodb.log"
@marinsagovac
marinsagovac / Logrotate unix
Created December 15, 2017 10:50
Logrotate unix
LOGROTATE CENTOS
================
INFO
====
Check is logrotate active:
cat /etc/cron.daily/logrotate
@marinsagovac
marinsagovac / Gearman PHP 7
Last active January 1, 2018 19:02
Gearman PHP 7
=== Install Gearman ===
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php7.0 php7.0-fpm php-gearman
sudo touch /var/log/gearmand.log
sudo chmod 0666 /var/log/gearmand.log
gearmand -d
@marinsagovac
marinsagovac / Docker
Last active January 2, 2018 15:18
Docker
=== Install ===
=== Prepare Docker ===
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
41 stable"
sudo apt-get install docker-ce
@marinsagovac
marinsagovac / Redis Ubuntu PHP
Created January 18, 2018 10:19
Redis Ubuntu PHP
# Install Redis
sudo apt-get install redis-server
sudo apt-get install php-redis
sudo nano /etc/redis/redis.conf
Edit:
maxmemory 128mb