Skip to content

Instantly share code, notes, and snippets.

Avatar

NamH namchuai

View GitHub Profile
@namchuai
namchuai / .tmux.conf
Last active May 8, 2021
My tmux configuration
View .tmux.conf
# prevent tmux from waiting for key combination when press escape
set -sg escape-time 0
# select different pane
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# allow using mouse
@namchuai
namchuai / show_dialog.java
Created May 8, 2020
Android: Showing System popup from service
View show_dialog.java
AlertDialog alertDialog = new AlertDialog.Builder(this)
.setTitle("Title")
.setMessage("Are you sure?")
.create();
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
alertDialog.show();
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
View roman_converter.dart
void main() {
final VALUES = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
};
@namchuai
namchuai / command.sql
Created Mar 25, 2020
Some postgresql command
View command.sql
# truncate the table and reset the index
truncate table <table_name> restart identity
@namchuai
namchuai / install virtualenv ubuntu 16.04.md
Created Feb 7, 2020 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04
View install virtualenv ubuntu 16.04.md

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@namchuai
namchuai / Threads.cpp
Created Oct 15, 2019
Modified android audioflinger
View Threads.cpp
/*
**
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
View Getting board id mac
Just paste the line to terminal. I'm not created the script. Just a note for me or someone when needed.
var_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id);var_ID=${var_ID##*<\"};var_ID=${var_ID%%\">};echo $var_ID\n
View Getting board id mac
Just paste the line to terminal. I'm not created the script. Just a note for me or someone when needed.
var_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id);var_ID=${var_ID##*<\"};var_ID=${var_ID%%\">};echo $var_ID\n
View Getting board id mac
Just paste the line to terminal. I'm not created the script. Just a note for me or someone when needed.
var_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id);var_ID=${var_ID##*<\"};var_ID=${var_ID%%\">};echo $var_ID\n
View Getting board id mac
Just paste the line to terminal. I'm not created the script. Just a note for me or someone when needed.
var_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id);var_ID=${var_ID##*<\"};var_ID=${var_ID%%\">};echo $var_ID\n