Skip to content

Instantly share code, notes, and snippets.

View tpphu's full-sized avatar

Tran Phong Phu tpphu

View GitHub Profile

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@tpphu
tpphu / .gitconfig
Created May 13, 2020 10:11 — forked from veggiemonk/.gitconfig
simple zshrc config file with Oh-My-ZSH
[user]
name = Julien Bisconti
email = ******
[core]
excludesfile = ~/.gitignore
pager = diff-so-fancy | less --tabs=1,5 -R
editor = /usr/bin/vim
[alias]
wow = log --all --graph --decorate --oneline --simplify-by-decoration

Keybase proof

I hereby claim:

  • I am tpphu on github.
  • I am hackthemoon1 (https://keybase.io/hackthemoon1) on keybase.
  • I have a public key ASA0Bzga2B_oQcBGgNnd2gHNXkkSAO1Dv7AjoEEZz7qkpAo

To claim this, I am signing this object:

@tpphu
tpphu / di-in-fp.md
Created May 31, 2019 08:45 — forked from gvolpe/di-in-fp.md
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@tpphu
tpphu / awesome-online-developer-tools.md
Last active May 17, 2018 09:28
Awesome online developer tools

Password Generation

@tpphu
tpphu / golang_job_queue.md
Created July 11, 2017 11:27 — forked from harlow/golang_job_queue.md
Job queues in Golang
@tpphu
tpphu / install-gcc48-linuxbrew-centos6.md
Created March 2, 2016 11:17 — forked from stephenturner/install-gcc48-linuxbrew-centos6.md
Installing gcc 4.8 and Linuxbrew on CentOS 6

Installing gcc 4.8 and Linuxbrew on CentOS 6

The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install Linuxbrew you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.

Note: Requires sudo privileges.

Resources:

@tpphu
tpphu / introrx.md
Last active August 29, 2015 14:27 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@tpphu
tpphu / fabfile.py
Last active August 29, 2015 14:11 — forked from kmpm/fabfile.py
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
@tpphu
tpphu / gist:5667615
Last active December 17, 2015 20:29
private function _getImageNameAndReceive($name, $subPath = null)
{
$ret_name = '';
/*@var $imageElement Zend_Form_Element_File*/
$imageElement = $this->$name;
if( !empty($imageElement) )
{
$image_name = $imageElement->getFileName(null, false);
if ( !empty($image_name) )
{