Skip to content

Instantly share code, notes, and snippets.

View luckymancvp's full-sized avatar

ダン・タイン・トゥー luckymancvp

View GitHub Profile

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Mac Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you will see an error like this:

$ npm update npm -g
@luckymancvp
luckymancvp / guide.md
Last active August 29, 2015 14:06
MonkeyTalk Build Guide

This is a guide to create apk file with monkeytalk Agent from your apk file

1.Create new folder called : monkeyTalk or whatever you want

2.Copy and paste monkeytalk-agent-2.0.8.jar and monkeytalkpro-ant-2.0.8.beta.jar to monkeyTalk

3.Create build.xml inside that folder

@luckymancvp
luckymancvp / android.sh
Created September 27, 2014 18:34
Show keystore
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
@luckymancvp
luckymancvp / readme.md
Last active August 29, 2015 14:07
Cách sử dụng Socket.io v0.9

Note cách sử dụng Socket.io v0.9

Listen Event

  1. Đối với socket.io phải đăng ký sự kiện cần lắng nghe rồi đưa ra handler cho từng trường hợp cụ thể ( đã thử nghiệm với angularJS, android socket io)

  2. Trong android quá trình để kết nối và lắng nghe sự kiện diễn ra như sau

@luckymancvp
luckymancvp / TakeScreenShot.java
Created October 2, 2014 16:17
Android Code Snippet
private void takeScreenShot() {
// image naming and path to include sd card appending name you choose for file
String mPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString() + "/ScreenShots";
File folder = new File(mPath);
boolean success = true;
if (!folder.exists()) {
success = folder.mkdir();
}
if (!success) {
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.
# Install tmux on Centos release 6.6
sudo yum install -y gcc kernel-devel make ncurses-devel
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
make
sudo make install
# centos 6.6 on Google Cloud
sudo yum check-update
sudo yum -y install httpd mysql-server php php-mysql
sudo service httpd start
sudo service mysqld start
sudo chkconfig httpd on
sudo chkconfig mysqld on
# Installing Chrome
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
hdiutil mount -nobrowse googlechrome.dmg
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications
hdiutil unmount "/Volumes/Google Chrome"
rm googlechrome.dmg
# Installing Firefox
curl -L -o Firefox.dmg "http://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US"
hdiutil mount -nobrowse Firefox.dmg
@luckymancvp
luckymancvp / 0_reuse_code.js
Last active September 1, 2015 04:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console