Skip to content

Instantly share code, notes, and snippets.

@dohaivu
dohaivu / setup.md
Last active May 26, 2018 02:27
[ubuntu commands] #cli

Package

# list package
sudo apt list --installed | grep -i apache
sudo dpkg -l
@dohaivu
dohaivu / setup.md
Last active January 9, 2018 00:03
[mongodb setup]

Setup

# start
./bin/mongod --dbpath /Users/haivu/dev/mongodb-osx-x86_64-3.6.1/data

Commands

mongo [server]//mongo shell
@dohaivu
dohaivu / daemon.md
Last active February 19, 2018 02:03
[nodejs commands] #nodejs daemon debug forvever pm2
@dohaivu
dohaivu / numpy.md
Last active August 14, 2017 01:07
[numpy] shape #python

Links

https://stackoverflow.com/questions/22053050/difference-between-numpy-array-shape-r-1-and-r

Array

Numpy arrays are not vectors. Or matrices for that matters. They're arrays.

They can be used to represent vectors, matrices, tensors or anything you want. The genius of numpy however is to represent arrays, and let the user decide on their meaning.

It is a table of elements (usually numbers), all of the same type, indexed by a tuple of positive integers. In NumPy dimensions are called axes. The number of axes is rank.

@dohaivu
dohaivu / commands.md
Last active July 25, 2017 02:32
[Android commands] commands for #android emulator

Emulator

./emulator -list-avds
./emulator @Nexus_5_API_23 -accel off -engine qemu2  -gpu off -verbose # start emulator
@dohaivu
dohaivu / mac.md
Last active January 26, 2018 04:34
[mac info] commands, utility, tips & tricks on #mac

Xcode

xcode-select -p
# select default xcode 
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

Zip

# view content
@dohaivu
dohaivu / customfont.java
Created July 12, 2017 07:49
[typeface in android] custom font on #android
public void showPopup(View v) {
PopupMenu popupMenu = new PopupMenu(this, v);
popupMenu.inflate(R.menu.menu_user_profile);
for (int i = 0; i < popupMenu.getMenu().size(); i++) {
MenuItem item = popupMenu.getMenu().getItem(i);
Typeface robotoRegular = HeloTypefaceManager.TypefaceWithFontName(this, HeloTypefaceManager.ROBOTO_REGULAR);
SpannableString title = new SpannableString(item.getTitle());
title.setSpan(new CustomTypefaceSpan("", robotoRegular), 0, title.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
@dohaivu
dohaivu / library.md
Last active June 12, 2018 00:11
[Android library] A collection of #android library: image, annimation