Skip to content

Instantly share code, notes, and snippets.

hoangtranwork / get_team_user_id.txt
Created July 8, 2024 07:41
How to get MS Teams user_id
1. use the web version of MS Team
2. compose a chat message with the user mentioned (@The Name). DO NOT SEND the message
3. View source (may highlight the message and view-selection-source), and find the ID in the source.
hoangtranwork /
Last active March 7, 2021 04:32
problem with installing python on macOS 2021-03-07 (asdf)
# this helps:
AR=/usr/bin/ar asdf install python 3.9.2
# install rename tool
brew install rename
# add -n to dry-run
rename --camelcase -s '2001-01-0' '' -S '-' '' -s 'Eng.' '000.' -s '.Midi' '.mid' MIDI/*
rename --camelcase -s '2001-01-0' '' -S '-' '' -s 'Eng.' '000.' -s '.Pdf' '.pdf' PDF/*
rename --camelcase -s '2001-01-0' '' -S '-' '' -s 'Eng.' '000.' -s '.Mxl' '.mxl' MXL/*
Verifying my Blockstack ID is secured with the address 1Kzj9aLDdXm4LaK8Ttpv6PJDDALLZ7t1D8
sudo bash -c "cat <<EOT > /etc/logrotate.d/api
/opt/app/*.log {
size 10k
hoangtranwork / DateUtil.kt
Last active October 12, 2018 17:14
Java/Kotlin DateTimeFormatter to parse Apple version of RFC3339 date returned by Apple API (Itune receipt)
val appleRfc3339DateFormatter: DateTimeFormatter =
.appendValue(YEAR, 4).appendLiteral('-').appendValue(MONTH_OF_YEAR, 2).appendLiteral('-').appendValue(DAY_OF_MONTH, 2)
.appendLiteral(' ')
.appendValue(HOUR_OF_DAY, 2).appendLiteral(':').appendValue(MINUTE_OF_HOUR, 2).appendLiteral(':').appendValue(SECOND_OF_MINUTE, 2)
.appendLiteral(' ')
val aRfc3339DateString = "2016-03-17 03:24:38 Etc/GMT"
hoangtranwork /
Last active October 10, 2018 08:25
Steps to make Firefox open maximized on macOS
  1. Get the profile folder location in about:support page

  2. Edit the file xulstore.json found in the above folder. It's a json file and we need only to edit the key main-window to something like this:



  • Step 2 should be done when Firefox is not open, as it seems that the file get updated when Firefox closes.
  • Sometimes you need to put negative value to screenX if the windows is still shifted abit from the screen edge.
hoangtranwork /
Created October 3, 2018 14:04
s3 bucket filtering in different ways
fn process(buckets: Vec<Bucket>) {
buckets.iter().filter(|b| == Some(EXACT_NAME.to_string())).for_each(|b| println!("{:#?}", b));
.filter(|b| {
let matched =; && matched
.for_each(|b| println!("{:#?}", b));
class ConsoleStringTable {
private data class Index(val row: Int, val column: Int)
private val contents = mutableMapOf<Index, String>()
private val columnSizes = mutableMapOf<Int, Int>()
private var rowCount = 0
private var columnCount = 0
hoangtranwork / xxf.zsh-theme
Last active December 19, 2018 22:48 — forked from xfanwu/xxf.zsh-theme
Yet another theme for oh-my-zsh
# Copy and self modified from ys.zsh-theme, the one of default themes in master repository
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background and the font Inconsolata.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
# 2 Jul 2015 - Xiaofan
# Machine name.
function box_name {