Skip to content

Instantly share code, notes, and snippets.

@tokhi
tokhi / monit.md
Last active August 29, 2015 14:05
monit installation on gentoo

Monit Documentation

Note
Monit has to be configured through the root user.
Use sudo su - to login as root user.

Monit Installation

@tokhi
tokhi / ftp_sync.sh
Last active August 29, 2015 14:08
Via script below you can download and sync directories from a remote ftp server to your local directory and vice versa. This script also support utf-8 filenames
#!/bin/bash
HOST="example.com"
USER="user"
PASS="password"
FTPURL="ftp://$USER:$PASS@$HOST"
echo $FTPURL
LCD="/home/user/local/directory"
RCD="/ftp/remote/directory"
# sync remote directory to the local directory (download)
@tokhi
tokhi / git_commands.sh
Last active August 29, 2015 14:08
git fanky commands
# http://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
# compare old commits with the new commit file changed
$ git log -p -2
# which files changed on a specific commit revision
$ git log --stat
# print each commit with a signle line and commit revision
git log --pretty=oneline
getallunits=tcp://127.0.0.1:5556
activateunits=tcp://127.0.0.1:5556
getallsites=tcp://127.0.0.1:5556
activatesites=tcp://127.0.0.1:5556
getallverticals=tcp://127.0.0.1:5556
activateverticals=tcp://127.0.0.1:5556
getallarticles=tcp://127.0.0.1:5556
activatearticles=tcp://127.0.0.1:5556
getallpages=tcp://127.0.0.1:5556
activatepages=tcp://127.0.0.1:5556
@tokhi
tokhi / ruby_tips.md
Last active April 1, 2016 12:13
Some cool ruby tips and tricks...
@tokhi
tokhi / vela2.rb
Last active April 15, 2016 09:40
v = Vela::DB.new
v.src_connection(user: 'user', password: 'pass', host: '127.0.0.1', database: 'testpdb', adapter: 'postgresql')
v.dst_connection(user: 'root', password: 'pass', host: '127.0.0.1', database: 'testdb', adapter: 'mysql')
v.dbsync("src_tbl", "dst_tbl") # destination table should already been exist
# if your destination tables' columns are different than the source table (e.g; clonse `col1` data to m_col1 column):
v.dbsync("your_src_tbl", "your_dst_tbl", {"col1" => "m_col1", "col2" => "m_col2"}) # you can add as much as column as you want
@tokhi
tokhi / vela.rb
Last active April 15, 2016 09:40
v = Vela::DB.new
v.src_connection(user: 'root', password: 'pass', host: '127.0.0.1', database: 'testdb', adapter: 'mysql')
v.dst_connection(user: 'user', password: 'pass', host: '127.0.0.1', database: 'testpdb', adapter: 'postgresql')
v.dbsync("src_tbl", "dst_tbl") # destination table should already been exist
# if your destination tables' columns are different than the source table (e.g; clonse `col1` data to m_col1 column):
v.dbsync("your_src_tbl", "your_dst_tbl", {"col1" => "m_col1", "col2" => "m_col2"}) # you can add as much as column as you want
@tokhi
tokhi / add_remove_custom_fields.md
Last active June 21, 2016 15:46
Adding and removing bootstrap custom fields like wordpress.

Adding/removing custom fields

Add and remove bootstrap custom fields by single clicks

index.html file:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" 
<link rel="stylesheet" href="scripts/main.js" 
@tokhi
tokhi / docker.sh
Last active December 28, 2016 19:35
# install docker toolbox
# create docker machine:
#docker-machine create --driver virtualbox default
eval "$(docker-machine env default)"
# check the version
docker version
docker-compose build
docker-compose up
# nginx installation
@tokhi
tokhi / ElasticSearch.md
Last active January 6, 2017 00:44
Elastic Search in simple words

Elastic Search

Elasticsearch is a real time search engine where a change to an index will be propegated to the whole cluster within a second.

An elasticsearch cluster indicated as one or more nodes, collection of nodes containing all the data, default cluster name is elasticserach.

A node is a single server and part of a cluster, node participate in searching and indexing.

Index is collection of documents equavalent to a database within a relational system, index name must be lowercase Type is represetn a class = table