usunyu   Stay hungry. Stay foolish.

Switch to integrated graphics when using battery on macOS

Run them one after the other. Each command sets a different system flag. They’re persistent once set. However, if you go into power options in Preferences and set the flag to autoswitch, it appears that these are reset to defaults.

Limit HandBrake and others from taking 100% CPU

For macOS, Download cputhrottle

Unity Location of downloaded Asset files

You rarely need to access the files downloaded from the Asset Store directly. However, if you do need to, you can find them in the following paths:

Default file extension for content-type

``` types { text/html html htm shtml; text/css css; text/xml xml; image/gif gif; image/jpeg jpeg jpg; application/x-javascript js; application/atom+xml atom; application/rss+xml rss;

Fix permission denied (publickey) when SSH Access to Amazon EC2

I accidentally messed up the /home/ubuntu/.ssh/authorized_keys of AWS EC2, and cannot access EC2 from SSH. Here are the steps for fixing it:

Create Your First Flutter App

flutter create --org com.usunyu -i swift -a kotlin --description 'First flutter app' first_flutter_app

How to install ubuntu16.04 gui on AWS and access from Mac

Create new user with password login

Glossary of Metrics

ARPDAU:

Average Revenue Per Daily Active User developers who are focused on DAU tend to track ARPDAU as a means to estimate the amount of revenue generated by users on any given day. While a potentially interesting metric to track, other monetization metrics (e.g. ARPPU, ARPU) can share more informative trends about your app.

ARPDAU = [Total Revenue for a Given Day] / [Number of Active Users that Day] 

HTTP to HTTPS With LetsEncrypt (Django, Nginx)

Step 1 Install letsencrypt:

$ sudo apt-get update
$ sudo apt-get install letsencrypt

How to reset Django migrations

Remove the all migrations files within your project:

Go through each of your projects apps migration folder and remove everything inside, except the init.py file.

Special Folder Names in your Assets Folder

Hidden Folders:

Folders that start with a dot (e.g. “.UnitTests/”, “.svn/”) are ignored by Unity. Any assets in there are not imported, and any scripts in there are not compiled. They will not show up in the Project view.

Show hidden files on macOS

Show hidden files:

$ defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

Java VM Type Signatures

Signature Java Type
Z boolean
B byte
C char
S short
I int
J long
F float
D double
L fully-qualified-class ; fully-qualified-class
[ type type[]
( arg-types ) ret-type method type

Resolve std::copy C4996 Error

Reduce .git folder size

To see the 10 biggest files, run this from the root directory:

Autohotkey Mac Key Mapping

Add file Ctrl-Alt-Switch.ahk to shell:startup:

Make Outside-In Sphere in Blender

IMAGE

Sublime Tips

Terminal Setup for Mac:

$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Unity Editor and Player Log File

Editor Logs:

Setup Nginx+RTMP on MacOS

1.安装Homebrow

已经安装了brow的可以直接跳过这一步。

Use Boost for Serialization

Use boost on MacOS:

Setup ffmpeg on Xcode

Install ffmpeg, please check (install ffmpeg)

Setup GLFW and GLEW on a Mac

IMAGE

Install and Use OpenCV 3.0.0 in Mac

IMAGE

Installing ffmpeg with libx264 (h264) on MAC OS X

Install libx264:

Get the libx264 package from videolan x264

ADB Shell Command

$ adb devices
$ // take screenshot
$ adb shell screencap -p /sdcard/screencap.png
$ adb pull /sdcard/screencap.png
$ // transfer file
$ adb push filename.zip /sdcard/
$ // pull apk
$ adb shell pm list packages
$ adb shell pm path com.example.package
$ adb pull <path_returned>

Git Bisect

$ git bisect reset
$ git bisect start
$ git bisect bad
$ git bisect good <commit>
Bisecting: 10 revisions left to test after this (roughly 3 steps)
...

FFmpeg Useful Commands

Download and install ffmpeg

Installing ADB on MAC OS X

Using Homebrew:

This is the easiest way and will provide automatic updates.

1. Install homebrew:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Consumer-Centric API Design

Examples of Abstraction:

Heroku Command Tips

Add Vim:

$ heroku plugins:install https://github.com/naaman/heroku-vim
$ heroku vim

Postgres Command Tips

Create databases:

$ CREATE DATABASE name
    [ [ WITH ] [ OWNER [=] user_name ]
           [ TEMPLATE [=] template ]
           [ ENCODING [=] encoding ]
           [ LC_COLLATE [=] lc_collate ]
           [ LC_CTYPE [=] lc_ctype ]
           [ TABLESPACE [=] tablespace ]
           [ CONNECTION LIMIT [=] connlimit ] ]

Writing your first Django app

1. Throughout this tutorial, we’ll walk you through the creation of a basic poll application.


Check Django is installed and which version (Setup Django):

$ python -c "import django; print(django.get_version())"

Start a Simple Web Server from Any Directory

// Mac
$ python -m SimpleHTTPServer 8000
// Windows
$ python -m http.server 8000

MySQL Command Tips

Invoke MySQL:

$ mysql
$ mysql -u root -p
$ mysql --user=your-user-name --password=your-password

Setup Ruby on Rails Environments

  1. Homebrew:

Setup Django Environments

In order to actually build projects, we need to make sure our computer is setup. In this project, we’ll setup your environment. Made for Mac OS X Mavericks which is the latest, free operating system from Apple.

Create Rails Project

Getting Started with Rails 4.x on Heroku:

$ rails new test_project -d mysql
$ bundle install
$ rails server
$ rails s
$ heroku login
// add to gem 'rails_12factor', group: :production Gemfile
$ bundle install
// add to  ruby “2.0.0” Gemfile
// in App folder
$ git init
$ git add .
$ git commit -m "init"
$ heroku create
$ git config -e