Skip to content

Instantly share code, notes, and snippets.

@tieubao
tieubao / market-maker.md
Created October 30, 2025 09:28 — forked from tubackkhoa/market-maker.md
Trading Notes

Chương 1: Quản Lý Tiền Bạc Để Thành Công Trong Giao Dịch Ngày (Managing Money to Succeed as a Day Trader)

  • Kiểm soát rủi ro là nền tảng: Kết quả giao dịch không kiểm soát được, nhưng mức lỗ thì có; sống sót qua kỷ luật để học hỏi.
  • Vị thế quá lớn gây hại: Gây mất lớn, cảm xúc mạnh (tham lam/sợ hãi); cắt lợi nhuận sớm, giữ lỗ lâu; rủi ro 50-100% vốn một lệnh = cờ bạc, không phải giao dịch.
  • Chỉ giao dịch tiền có thể mất: Không phụ thuộc vào thắng để sống; mất hết = không sao; giảm gắn bó cảm xúc, tăng khách quan.
  • Nhỏ hơn = lớn hơn: Vị thế nhỏ giúp cắt lỗ nhanh, phục hồi dễ; vị thế lớn cần lợi nhuận cao hơn để bù phí, thời gian.
  • Điều chỉnh vị thế cân bằng: Dựa giá cổ phiếu (ví dụ: 1 điểm ở $10 = 10%, ở $100 = 1%); vị thế tỷ lệ nghịch với giá để rủi ro % bằng nhau.
  • Quy tắc 2%: Mất tối đa 2% vốn/lệnh (bao gồm phí); lỗ 6-8% tháng = dừng, đánh giá; dùng để bảo hiểm, tăng cơ hội chơi lâu dài.
  • Biên (margin): Tăng đòn bẩy nhưng rủi ro cao (ví dụ: LTCM phá sản 1997 do 20:
@tieubao
tieubao / webm2gif.sh
Created August 26, 2023 09:26
webm2gif
function webm2gif() {
ffmpeg -y -i "$1" -vf palettegen _tmp_palette.png
ffmpeg -y -i "$1" -i _tmp_palette.png -filter_complex paletteuse -r 10 "${1%.webm}.gif"
rm -rf _tmp_palette.png
}
@tieubao
tieubao / one_liners.md
Created April 8, 2020 19:57 — forked from brannondorsey/one_liners.md
One Liners

Count the number of unique characters in a file

# https://unix.stackexchange.com/questions/5010/how-can-i-count-the-number-of-different-characters-in-a-file # works for linux. There is a variation for MacOS in the link ^ sed 's/\(.\)/\1\n/g' text.txt | sort | uniq -c # sort -nr # uncomment this to sort the list by frequency

Replace a string in all instances of files in a directory

@tieubao
tieubao / traffic.sh
Created April 8, 2020 19:43 — forked from radu-gheorghe/traffic.sh
bash script for checking out traffic via /proc/net/dev
#!/bin/bash
#shows traffic on the specified device
function human_readable {
VALUE=$1
BIGGIFIERS=( B K M G )
CURRENT_BIGGIFIER=0
while [ $VALUE -gt 10000 ] ;do
VALUE=$(($VALUE/1000))
@tieubao
tieubao / tcp_flags.txt
Created April 8, 2020 19:26 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@tieubao
tieubao / notion2blog.js
Created April 7, 2020 21:06 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@tieubao
tieubao / docker-cleanup-resources.md
Created December 21, 2019 08:02 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes $ docker volume rm $(docker volume ls -qf dangling=true) 

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@tieubao
tieubao / README.MD
Created June 10, 2019 16:36 — forked from duythinht/README.MD
That was a thing, which I want.
  • Must have Dockerfile inside project, that able to run docker built -t test:1.0.0 ./
  • Image must be expose port as 80
  • Image after build could run directly without any config file, config only accept to inject by environment variables
docker run -e "MYSQL_HOST=127.0.0.1" -e "MYSQL_USERNAME=root" test:1.0.0 
  • Must have Jenkins file follow this pattern
pipeline { agent any 
@tieubao
tieubao / macos_on_ubuntu.md
Created April 7, 2019 17:25 — forked from stefanocoding/macos_on_ubuntu.md
Install macOS in a VirtualBox machine on Ubuntu

Important: I'm writing this when the last version of macOS (and the one I have installed) is Mojave. There is already a script which installs Mojave in a virtual machine here https://github.com/img2tab/okiomov. But if you are curios how to do everything manually to install High Sierra, then this guide may be useful.

After reading a few articles I ended up with these steps:

  1. On macOS, download the High Sierra installer (even if you have Mojave installed): https://itunes.apple.com/us/app/macos-high-sierra/id1246284741?ls=1&mt=12
  2. If the High Sierra Installer starts, quit it.
  3. Open "Disk Utility".
  4. Click on "File" > "New Image" > "Blank image...". Or just press cmd+N.