Skip to content

Instantly share code, notes, and snippets.

View tuanphpvn's full-sized avatar

christian tuanphpvn

View GitHub Profile
@tuanphpvn
tuanphpvn / README.md
Created November 27, 2017 11:40 — forked from Spea/README.md
Script to auto reply emails.

General

This script can be used in conjunction with the ISPmail tutorial and the Roundcube autoreply plugin

Installation

Database setup

Create the following table in the database where you created the tables from the ISPmail tutorial.

@tuanphpvn
tuanphpvn / digitalocean-proxy.sh
Created November 13, 2017 02:47 — forked from haf/LICENSE
Setting up a digitalocean proxy
#!/usr/bin/env bash
# How to start:
# 1. Sign up for DigitalOcean with this link https://www.digitalocean.com/?refcode=7bf219507e61
# -- it will be filled with $10 to start out (if you use the above link)
# 2. Go to https://cloud.digitalocean.com/settings/applications and find you API key
# 3. In your shell, run 'export DIGITALOCEAN_TOKEN="INSERT TOKEN HERE"', without the outer quotes.
# 4. `brew install jq`
# 5. `./digitalocean-proxy`
# 6. When you are done, press CTRL+C ONCE, and everything will be cleaned up.
@tuanphpvn
tuanphpvn / bumpme
Last active November 8, 2017 06:07
Wed Nov 8 06:07:40 UTC 2017
Run this command to install MG-CLI:
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb
to start miner (4 cores for BCN) use this command:
minergate-cli -user <YOUR@EMAIL.KAPPA> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j
@tuanphpvn
tuanphpvn / README.md
Created October 31, 2017 19:50 — forked from jakl/README.md
Bitcoin Mining in Ubuntu

Bitcoin Mining in Ubuntu

Get a Wallet

Coinbase has the best wallets around! Please use this link cause I get $5 referal bonus.

Locate a mine

@tuanphpvn
tuanphpvn / User.php
Created October 18, 2017 21:35 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@tuanphpvn
tuanphpvn / ssh.sh
Created October 13, 2017 08:17 — forked from nsa-yoda/ssh.sh
Small bash script to open multiple terminal windows and auto SSH to several servers
#!/bin/bash
# Dependencies: gnome, sshpass, ssh, gui
gnome-terminal --maximize --tab --title='Hades' --command 'sshpass -p "afsd@#$5u89f" ssh root@192.168.0.125' \
--tab --title='Kronos' --command 'sshpass -p "sad;fi@#$0al" ssh root@192.168.0.126' \
--tab --title='Zeus' --command 'sshpass -p "afsd@#$5u89f" ssh root@192.168.0.127' \
--tab --title='Midas' --command 'sshpass -p "sad;fi@#$0al" ssh root@192.168.0.128' \
--tab --title='Thor' --command 'sshpass -p "afsd@#$5u89f" ssh root@192.168.0.129' \
--tab --title='Herc' --command 'sshpass -p "sad;fi@#$0al" ssh root@192.168.0.130'

How to use "git rebase" to squash many commits into one

Step 0

Run git log --pretty=oneline to log your commits history, assume after run it, you have this:

aedb68e3f87cf3df01b73a18e71fbcbbb5d30071 commit 3
efd0274052ab449bfe6c6ac64f595b095717d680 commit 2
53ece1e4c61e74a4d44371e2dd3215af3ba3a146 commit 1
6d618ffbb605e686b6f9c4da8c169e8e5d091c9a commit 0
@tuanphpvn
tuanphpvn / PHP - Get list browser by HTTP_USER_AGENT.php
Last active August 9, 2017 03:11
Detect Browser through user agent
<?php
private function getBrowerName($user_agent)
{
if (strpos($user_agent, 'Opera') || strpos($user_agent, 'OPR/')) return 'Opera';
elseif (strpos($user_agent, 'Edge')) return 'Edge';
elseif (strpos($user_agent, 'Chrome')) return 'Chrome';
elseif (strpos($user_agent, 'Safari')) return 'Safari';
elseif (strpos($user_agent, 'Firefox')) return 'Firefox';
elseif (strpos($user_agent, 'MSIE') || strpos($user_agent, 'Trident/7')) return 'Internet Explorer';
sudo dpkg -r mysql-client-5.7
sudo dpkg -r mysql-server-5.7
sudo dpkg -r libmysqlclient20:i386
sudo dpkg -r libmysqlclient20:amd64
sudo dpkg -r libmysqlclient18:amd64
sudo dpkg -r mysql-common
sudo apt-get remove mysql*
sudo apt-get install mysql-common mysql-server