Skip to content

Instantly share code, notes, and snippets.

View trungnt13's full-sized avatar
:octocat:
Coding, coding, ... and still coding

Trung Ngo trungnt13

:octocat:
Coding, coding, ... and still coding
View GitHub Profile
@trungnt13
trungnt13 / .clang-format
Last active April 14, 2023 12:48
[CheatSheet] Clang Format
# Refer to the following link for the explanation of each params:
# http://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormatStyleOptions.html
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
@trungnt13
trungnt13 / CurlWget.md
Last active April 14, 2023 12:26
[CheatSheet] Curl and Wget
@trungnt13
trungnt13 / postgres-cheatsheet.md
Created October 7, 2022 09:50 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@trungnt13
trungnt13 / midas_loss.py
Created June 12, 2022 20:08 — forked from dvdhfnr/midas_loss.py
Loss function of MiDaS
import torch
import torch.nn as nn
def compute_scale_and_shift(prediction, target, mask):
# system matrix: A = [[a_00, a_01], [a_10, a_11]]
a_00 = torch.sum(mask * prediction * prediction, (1, 2))
a_01 = torch.sum(mask * prediction, (1, 2))
a_11 = torch.sum(mask, (1, 2))
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF)
# https://github.com/apache/tvm/tree/main/docker/install
. /etc/profile
set -o errexit -o nounset
set -o pipefail
ANDROID_HOME=/opt/android-sdk-linux
@trungnt13
trungnt13 / coconerd.json
Last active August 16, 2021 10:49
Coverage Badge
{"schemaVersion":1,"label":"Coverage","message":"79%","color":"yellow"}
@trungnt13
trungnt13 / voxceleb_f0.txt
Created October 27, 2020 18:33
Extracted F0 from Voxceleb dataset with gender labels
ID10001 m 112.3214
ID10002 m 140.6493
ID10003 m 146.4722
ID10004 m 120.6954
ID10005 m 150.4191
ID10006 f 165.4478
ID10007 f 270.6876
ID10008 f 225.5818
ID10009 m 200.2969
ID10010 m 102.2391
@trungnt13
trungnt13 / conda_initialize.sh
Created December 15, 2019 02:59
Bash initialization for Miniconda
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/trung/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/trung/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/trung/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/trung/miniconda3/bin:$PATH"