Skip to content

Instantly share code, notes, and snippets.

View dangkhoasdc's full-sized avatar
😎

Le Tan Dang Khoa dangkhoasdc

😎
View GitHub Profile
@dangkhoasdc
dangkhoasdc / Makefile
Created February 7, 2018 10:05
Makefile Template
CC := g++ # This is the main compiler
# CC := clang --analyze # and comment out the linker last line for sanity
SRCDIR := src
BUILDDIR := build
TARGET := bin/runner
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
CFLAGS := -g # -Wall

Vim Configuration

javacomplete2 + nvim-complete-manager

Compile algs4 with Maven

  1. Install maven
sudo apt-get install maven

Chính sách đổi hàng International Shipping của Amazon

Quy trình này mình tìm hiểu khi mua những hàng sử dụng International Shipping, lí do nó khiến mình quan ngại là vì:

  • Chính sách đổi trả của Amazon thế nào với hàng được chuyển quốc tế.
  • Nếu mình phải trả lại hàng (ví dụ gửi từ Singapore lại qua bên Mỹ) thì phía Amazon có chịu trả chi phí cho mình không?
  • Hàng mới được gửi như thế nào.

Sau đây là kinh nghiệm của mình sau 1 buổi sáng hì hục tìm hiểu:

@dangkhoasdc
dangkhoasdc / install_ubuntu_packages.sh
Created September 26, 2017 03:54
Ubuntu: install packages
sudo apt-get -y install python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
@dangkhoasdc
dangkhoasdc / VIM_tips.md
Last active November 10, 2017 12:24
VIM: tips and tricks

Searching and Substitution

Remove duplicates

:sort u

General

@dangkhoasdc
dangkhoasdc / setup_arch.sh
Last active October 24, 2019 10:58
Setup Arch OS
echo "Setup the workspace"
# pacman -S sudo
# install yay
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd .. & rm -rf yay
# essential dev tools
@dangkhoasdc
dangkhoasdc / windows10_speed_up.md
Last active May 20, 2023 21:25
Some tips&tricks to speed up windows 10

Network

Disable Windows Update delivery

Settings > Update & Security > Windows Update > Advanced Options:

  • Turn off the p2p file transfer [Recommend]
  • Limit the p2p transfer to PCs on the local network

Turn off background apps

@dangkhoasdc
dangkhoasdc / ct-strings.cc
Created April 18, 2017 02:54 — forked from daniel-j-h/ct-strings.cc
Compile-time strings and string concatenation
#include <stdexcept>
#include <utility>
class Str {
public:
template <std::size_t N>
constexpr Str(const char(&a)[N]) : p(a), s(N - 1) {}
constexpr char operator[](std::size_t n) const {
# source : https://ncrmnt.org/2016/04/21/cmake-atom-clang_complete/
message(STATUS "Generarating ${CMAKE_SOURCE_DIR}/.clang_complete")
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
file(WRITE ${CMAKE_SOURCE_DIR}/.clang_complete "")
foreach(dir ${dirs})
file(APPEND ${CMAKE_SOURCE_DIR}/.clang_complete "-I${dir}\n")
endforeach()
if(CMAKE_CXX_FLAGS)
string(REPLACE "'" "" CMAKE_C_FLAGS_SPLIT ${CMAKE_CXX_FLAGS})
import random
import sys
def partition(array, lo, hi):
pivot = random.randint(lo, hi)
i = lo+1
j = hi
array[lo], array[pivot] = array[pivot], array[lo]
while True: