Skip to content

Instantly share code, notes, and snippets.

View ndkhoa's full-sized avatar

Nguyen Dang Khoa ndkhoa

View GitHub Profile
@ndkhoa
ndkhoa / tien-len-mien-nam-by-bing-gpt.py
Created May 9, 2023 01:16 — forked from huytd/tien-len-mien-nam-by-bing-gpt.py
Card game Thirteen (a.k.a Tiến lên miền nam) made by Bing Chat
# Step 1: Import the random module
import random
# Step 2: Define a class for cards
class Card:
def __init__(self, rank, suit):
self.rank = rank # an integer from 3 to 15 (3 is lowest and 15 is highest)
self.suit = suit.lower() # a string from "spades", "clubs", "diamonds", or "hearts"
def __str__(self):
@ndkhoa
ndkhoa / rails http status codes
Created January 7, 2022 09:45 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@ndkhoa
ndkhoa / tmux-cheatsheet.markdown
Created March 30, 2021 13:57 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ndkhoa
ndkhoa / handling_multiple_github_accounts.md
Created December 24, 2020 02:53 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@ndkhoa
ndkhoa / Dockerfile
Created December 2, 2020 04:33 — forked from armand1m/Dockerfile
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@ndkhoa
ndkhoa / docker-compose-v1.yml
Created January 7, 2020 08:46 — forked from markheath/docker-compose-v1.yml
Elasticsearch docker compose examples
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
@ndkhoa
ndkhoa / Jenkinsfile
Created October 16, 2019 10:49 — forked from paulmthiebauth/Jenkinsfile
Jenkins Rcov Publisher MetricTarget Syntax
#The snippet generator for RcovPublisher in Jenkins is incomplete.
#When you add in metric values for desired coverage percentages, the generator doesnt provide the syntax.
#Here it is served up on a silver platter.
step([$class: 'RcovPublisher', reportDir: 'coverage/rcov', targets: [[$class: 'hudson.plugins.rubyMetrics.rcov.model.MetricTarget', metric: 'TOTAL_COVERAGE', healthy: 87, unhealthy: 86, unstable:85], [$class: 'hudson.plugins.rubyMetrics.rcov.model.MetricTarget', metric: 'CODE_COVERAGE', healthy: 87, unhealthy: 86, unstable: 85]]])
Link full khóa training device driver của embedded Linux ở đây nhé các bạn. Đây là video mình record trong khóa trước, do bị mắc 1 số lỗi về quay phát nên mình sẽ record lại trong khóa hiện tại mình đang dạy.
Bài 1: Kernel module - simple character device.
https://bit.ly/2AzsxrB
Bài 2: Giới thiệu về cơ chế timer trong hệ điều hành.
https://bit.ly/2O2rDpy
Bài 3: Hướng dẫn lập trình điều khiển interrupt trong Linux
kernel. https://bit.ly/2vtenmk
Bài 4: Giới thiệu về cơ chế system call trên Linux.
https://bit.ly/2KkXm32
Bài 5: Giới thiệu về kỹ thuật IPC - Inter Process Communication.
@ndkhoa
ndkhoa / .bashrc
Created July 17, 2019 11:12 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by