Skip to content

Instantly share code, notes, and snippets.

View algotrader-dotcom's full-sized avatar

Mai_Xoa algotrader-dotcom

View GitHub Profile
@algotrader-dotcom
algotrader-dotcom / install-tmux-on-centos-6x.txt
Last active October 6, 2015 06:32
Install tmux on Centos 6.x
# Install tmux on CentOS 6:
sudo rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
sudo yum install tmux -y
@algotrader-dotcom
algotrader-dotcom / kill-all-process-by-name.txt
Created October 6, 2015 06:36
Kill all process by name in linux
kill -9 `ps aux | grep middleman | awk '{print $2}'`
@algotrader-dotcom
algotrader-dotcom / tmux-cheatsheet
Created October 6, 2015 06:37
Tmux Cheatsheet
# Start new session with myname
tmux new -s myname
#Attach to tmux with named
tmux a -t myname
#List all tmux session
tmux ls
@algotrader-dotcom
algotrader-dotcom / drupal-7-memcached-storage-nginx-page-speed
Created October 6, 2015 06:41
Drupal 7 + Memcached Storage + Nginx page cached => Faster 700%
# 1. Introduction
With page cached in memcached, nginx will serve this page cached (html render) from nginx directly to user. So it’s very fast compared to norway it does.
# 2. Requirements
Memcached storage module
# 3. Installation
For sites/default/settings.php
## Advanced usage of Drupal page cache.
$conf['cache_backends'][] = ‘sites/all/modules/memcache_storage/memcache_storage.page_cache.inc';
@algotrader-dotcom
algotrader-dotcom / apache-tika-installation
Last active October 15, 2015 06:52
Apache Tika: extract metadata, text from PDF, XLS, Doc
# 1. Installation
git clone https://github.com/apache/tika.git
cd tika
export M2_HOME=/opt/apache-maven/apache-maven-2.2.1
mvn install
....
# 2. Usage
## Standlone commandline
@algotrader-dotcom
algotrader-dotcom / sample-app-mean-stack
Last active October 6, 2015 06:50
NodeCellar: Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
http://coenraets.org/blog/2012/10/nodecellar-sample-application-with-backbone-js-twitter-bootstrap-node-js-express-and-mongodb/
https://github.com/hiattp/express3-mongodb-bootstrap-demo
@algotrader-dotcom
algotrader-dotcom / ssh-copy-id
Last active October 6, 2015 08:52
Use ssh-copy-id on a different port
$ ssh-copy-id "user@host -p 6842"
OR
$ cat /home/tim/.ssh/id_rsa.pub | ssh tim@just.some.other.server 'cat >> .ssh/authorized_keys'
@algotrader-dotcom
algotrader-dotcom / ansible-installation
Last active October 6, 2015 10:52
Anisble Installation
## 1. http://www.cyberciti.biz/python-tutorials/linux-tutorial-install-ansible-configuration-management-and-it-automation-tool/
## 2. http://www.tecmint.com/install-and-configure-ansible-automation-tool-in-linux/
## 3. http://thornelabs.net/2014/03/08/install-ansible-create-your-inventory-file-and-run-an-ansible-playbook-and-some-ansible-commands.html
@algotrader-dotcom
algotrader-dotcom / ansible-how-tos
Last active October 7, 2015 07:25
Ansible HowTos
# /etc/ansible/hosts
[project1]
192.168.175.30 ansible_ssh_user=sysadmin ## nginx - load balancer
192.168.175.51 ansible_ssh_user=sysadmin ## web1
192.168.175.52 ansible_ssh_user=sysadmin ## web2
192.168.175.50 ansible_ssh_user=sysadmin ## MySQL
192.168.175.56 ansible_ssh_user=sysadmin ## MongoDB
[localhost]
@algotrader-dotcom
algotrader-dotcom / Get the title of a web page
Created October 7, 2015 06:13
[Python] Get the title of a web page
from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
print soup.title.string