Skip to content

Instantly share code, notes, and snippets.

View danielphan2003's full-sized avatar

Daniel Phan danielphan2003

View GitHub Profile
@danielphan2003
danielphan2003 / unordered_map_tr1.cpp
Created October 26, 2019 09:38
Using alpha version of std::tr1::unordered_map. Based on https://en.cppreference.com/w/cpp/container/unordered_map
#include <tr1/unordered_map>
#include <iostream>
#include <string>
int main()
{
// Create an unordered_map of three strings (that map to strings)
std::tr1::unordered_map<std::string, std::string> u;
u.insert({"RED","#FF0000"});

SẢN PHẨM

... XBW - 2088 - kéo điện có thể sạc lại được với kiểu dáng độc đáo và động cơ mạnh mẽ ít tiếng ồn. Pin có thể sạc lại tùy thích.

THÔNG SỐ KỸ THUẬT

Dòng điện vào: AC.220V - 50Hz Dòng điện ra: 3V DC.300mA Công suất tối đa: 18W

CÁCH THỨC SẠC ĐIỆN

local awful = require("awful")
-- local naughty = require("naughty")
local gears = require("gears")
local beautiful = require("beautiful")
local helpers = require("helpers")
local keys = {}
-- Mod keys
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, XK_Tab, swaptags, {.ui = 1 << TAG} },
#define STACKKEYS(MOD,ACTION) \
{ MOD, XK_j, ACTION##stack, {.i = INC(+1) } }, \
@danielphan2003
danielphan2003 / themachine-init-rescue.sh
Created October 18, 2020 13:46
How to rescue themachine
#!/usr/bin/env bash
o=defaults
o_btrfs=$o,ssd,zstd,noatime
# unlock the partition
cryptsetup open /dev/disk/by-partlabel/cryptsystem system
# setup encrypted swap
cryptsetup open --type plain --key-file /dev/urandom /dev/disk/by-partlabel/cryptswap swap
@danielphan2003
danielphan2003 / getAllStories.js
Created October 15, 2021 22:05
A script to get a list of stories from your Wattpad library, including the archive.
await (async (username) => {
const endpoints = {
"archive": 10,
"library": 25,
}
for (const endpoint in endpoints) {
const url = `https://www.wattpad.com/api/v3/users/${username}/${endpoint}`
const { total } = await (await fetch(`${url}?fields=total`)).json()
11-06 17:14:36.056 12825 12841 I com.tailscale.ipn: logtail started11-06 17:14:36.057 12825 12841 I com.tailscale.ipn: goSetupLogs: success
11-06 17:14:36.126 12825 12844 I com.tailscale.ipn: 3.9M/51.7M dns: using *router.CallbackRouter
11-06 17:14:36.127 12825 12844 I com.tailscale.ipn: 4.0M/51.7M link state: interfaces.State{defaultRoute=wlan0 ifs={wlan0:[192.168.1.5/24 2402:800:63a9:e55d:169f:3cff:fe96:2d8f/64 2402:800:63a9:e55d:3975:7ea8:d0e0:786/64]} v4=true v6=true}
11-06 17:14:36.138 12825 12844 I com.tailscale.ipn: 4.0M/52.0M magicsock: disco key = d:264f186ebded4730
11-06 17:14:36.138 12825 12844 I com.tailscale.ipn: 4.0M/52.0M Creating wireguard device...
11-06 17:14:36.140 12825 12844 I com.tailscale.ipn: 4.1M/52.2M Bringing wireguard device up...
11-06 17:14:36.144 12825 12841 I com.tailscale.ipn: 4.1M/52.4M Bringing router up...
11-06 17:14:36.144 12825 12841 I com.tailscale.ipn: 4.1M/52.4M Clearing router settings...
11-06 17:14:36.145 12825 12841 I com.tailscale.ipn: 4.1M/52.4M Starting link mo

1. Nhấn vào link invite Tailscale

Ví dụ https://login.tailscale.com/admin/invite/<id>

2. Đăng nhập băng email, Google, Microsoft hay GitHub.

Đừng đăng nhập bằng mail gm.uit.edu.vn hay ms.uit.edu.vn

tailscale login page

3. Thiết lập DNS qua Tailscale.

@danielphan2003
danielphan2003 / unikey.json
Created January 14, 2022 18:41
Unikey package for scoop.sh
{
"version": "4.3-rc5.200929",
"description": "UniKey - Bàn phím tiếng Việt",
"homepage": "https://www.unikey.org/",
"license": "GPL-3.0-or-later",
"architecture": {
"64bit": {
"url": "https://www.unikey.org/assets/release/unikey43RC5-200929-win64.zip",
"hash": "dea84f2b2ae0f2f0d24740efa67e8ded0ac51657c13cb7e123078eb27032527b"
},