Skip to content

Instantly share code, notes, and snippets.

@font-face {
font-family: "Minecraft Mono";
/* Add other properties here, as needed. For example: */
/*
font-weight: 100 900;
font-style: normal italic;
*/
src: url(data:application/octet-stream;base64,d09GRgABAAAAADtAABAAAAAAnQwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABbAAAABwAAAAcgj9IvUdERUYAAAGIAAAAIgAAACYAJwD6T1MvMgAAAawAAABVAAAAYNjROeFjbWFwAAACBAAAATcAAAF6eSlTcWN2dCAAAAM8AAAAGAAAABgHXw7YZnBnbQAAA1QAAAGxAAACZVO0L6dnYXNwAAAFCAAAAAgAAAAIAAAAEGdseWYAAAUQAAAwUQAAjLg5BAKuaGVhZAAANWQAAAA1AAAANg7rJUdoaGVhAAA1nAAAACAAAAAkEXwHyWhtdHgAADW8AAAAfgAAA1BHFCPebG9jYQAANjwAAAGeAAABqt1cuchtYXhwAAA33AAAACAAAAAgAfYBGm5hbWUAADf8AAAA/AAAAeoCc1AucG9zdAAAOPgAAAHGAAACkPkQtuBwcmVwAAA6wAAAAIAAAACqqHZquQAAAAEAAAAA2odvjwAAAADIeCtBAAAAAN8/rex42mNgZGBg4AFiMQY5BiYGRiC8DMQsQBEmIGaEYAAX8wEiAAB42mNgYTVj/MLAysDCUsQaysDA8ARCM/cxMDAeZ2BgYmDjZACDBqAgA6MDEwMUGJWUpDE4MCio/mGX+S/DwMBZyfjeAagJJMdSxGYJpBQYGAFuRAy6AAAAeNpjYGBgZoBgGQZGBhAoAfIYwXwWhgggLcQgABRhYqhj+KvApSCioK8Qr7BG9c///0A5BYYFCgwKAgix/4//H3pw4MHuBwsfFD1Qu3UdaiYaYGRjgEswMgE
#include <stdio.h>
const int N = 5;
int solve(int map[N][N], int x, int y, int ret[N][N]) {
if (map[y][x] == 2) {
return 1;
} else {
if (y - 1 >= 0 && map[y - 1][x] != 0 && ret[y - 1][x] == 0) {
ret[y - 1][x] = 1;
@huytd
huytd / dummy-dungeon-generator.cpp
Created August 26, 2022 22:01
Dummy dungeon generators
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <vector>
#include <stack>
#include <stdlib.h>
using namespace std;
const int SIZE = 40;
@huytd
huytd / rose-pine-moon.js
Created June 7, 2022 05:48
Rose Pine Moon color theme for Blink.sh - Modified from ng-hai/rose-pine-blinksh
const palette = {
base: "#232136",
surface: "#2a273f",
overlay: "#393552",
muted: "#6e6a86",
subtle: "#908caa",
text: "#e0def4",
love: "#eb6f92",
gold: "#f6c177",
rose: "#ea9a97",
@huytd
huytd / money-parser.rs
Created May 8, 2022 08:57
A simple recursive descent parser in Rust
use std::fmt::Display;
/*
money = currency_symbol number ;
currency_symbol = '$' | '£' | '€' ;
number = INTEGER ;
*/
#[derive(Debug, PartialEq, Clone, Copy)]
enum TokenType {
@huytd
huytd / recursive-descent-parser.go
Created May 7, 2022 06:48
Expression parser using Recursive Descent
package main
import (
"errors"
"fmt"
)
type AstNodeType int
const (
@huytd
huytd / stack-machine.rs
Created April 21, 2022 01:40
Stack machine in 150 lines of Rust
const STACK_SIZE: usize = 1024;
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
pub enum OpCode {
PUSH(i32),
ADD,
CMP, // 1 if equals, 0 if different
JMP_IF1(usize), // jump if top is 1
JMP(usize), // unconditionally jump
PRINT,
@huytd
huytd / monolight.sublime-color-scheme
Created March 22, 2022 07:32
Monochrome Light Color Scheme for Sublime
{
"name": "Mono Light",
"author": "Huy Tran",
"variables":
{
"textcolor": "#333333",
"stringcolor": "#6d8600",
"numbercolor": "#dc322f",
"commentcolor": "#bbbbbb",
"blue": "#333333",

minh.nguyen: Thông thường thì em sẽ follow theo (hầu hết) các bước sau:

  • RTFM.
  • Dựng và chạy hệ thống với các settings được recommend trong doc. Ví dụ Redis sẽ có sentinel hoặc Redis cluster hoặc standalone.
  • Explore tất cả các feature của system hoặc tất cả interface của library, nhất là những feature nào có vẻ fancy.
  • Build from source. Chạy lại bằng build object được sinh ra. Ngó thử xem hệ thống có bao nhiêu components, dependencies.
  • Đọc thử design doc nếu có
  • Debug thử xem giữa các component liên hệ với nhau như thế nào. Thông thường các hệ thống đều có doc.
  • Pick một flow đơn giản nhất, Tìm thử entrypoint trong code. Đặt debugger xem thử chạy ra sao.
  • Change thử một feature nho nhỏ xem thê nào
" General Settings
set update.lastchecktime 1686688430225
set update.nag true
set update.nagwait 7
set update.lastnaggedversion 1.14.0
set update.checkintervalsecs 86400
set configversion 2.0
set smoothscroll true
set newtab about:blank
set leavegithubalone true