Skip to content

Instantly share code, notes, and snippets.

View longtth's full-sized avatar

Long NguyenX longtth

View GitHub Profile

Filter input (là file csv) theo quy tắc:

  • nếu OUTLET VISIT ID là duy nhất, lấy
  • nếu OUTLET VISIT ID là trùng lặp (ví dụ: L080341096 bên dưới), lấy dòng có OUTLET VISIT DATE lớn nhất
  • nếu OUTLET VISIT ID chỉ trùng phần code, có thêm phần "đuôi" như cái L080341126 và cái L080341126-2021-06-12-1 vẫn tính là trùng lặp

chú ý

file csv có thể có 1,000,000 dòng trở lên

@longtth
longtth / delete-all-my-gists.js
Created June 3, 2020 03:19 — forked from gabmontes/delete-all-my-gists.js
Delete all your gists
var async = require('async');
var GitHubApi = require('github');
var github = new GitHubApi({
version: '3.0.0',
protocol: 'https'
});
github.authenticate({
type: 'basic',
@longtth
longtth / setting-golang.md
Created December 11, 2019 12:17
setting Go sau khi download từ web thay vì tải từ package manager

It's also really easy. On Linux, you can simply do:

# Install Go on Linux.
curl -L https://golang.org/dl/go1.8.1.linux-amd64.tar.gz | sudo tar zx -C /usr/local/

# Add to ~/.bash_profile.
export PATH="$PATH:/usr/local/go/bin:$HOME/go/bin"

Edit: Updated for Go 1.8.1. It's even easier now, because one can rely on default value of GOPATH instead of having to set it.

@longtth
longtth / excel-search-folder.bas
Created September 24, 2019 10:20
VBA search nội dung nhiều file excel trong folder
Type OPENFILENAME
IStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
@longtth
longtth / msword-export-tracked-changes.bas
Created August 31, 2019 05:39
export tracked changes in Word to new doc
Attribute VB_Name = "basTrackChanges_Extract"
Option Explicit
Public Sub ExtractTrackedChangesToNewDoc()
'Macro created 2007 by Lene Fredborg, DocTools - www.thedoctools.com
'The macro creates a new document
'and extracts insertions and deletions
'marked as tracked changes from the active document
'NOTE: Other types of changes are skipped
@longtth
longtth / giai-bai-tap.cs
Created August 23, 2019 03:02
S = 1 + x^2/2! + x^4/4! +...+ x^2n/2n!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GiaiBaiTap
{
class Program
{
@longtth
longtth / why-unarchivable-OKR.md
Created July 11, 2019 15:17
Why unarchivable OKR?

My company applied OKR, I've spent almost 2 hours learn my company's trainning video (45min), and spent serveral hours to research about what is OKR and how is it good, but I can't understand why our employer/manager force us to set unarchivable/unbelivable objectives. Say, my team is currently managing an infra system for about 1000 users, now they say, the OKR objective is not what you can do, it must be your dream, 70% is OK, blah blah... AND you SHOULD set the target from 1000 to 5000 next year, OR your objectives WILL BE REJECTED. Why, is it really work? The only thing I see from that is employer/manager is cheat on our work. If we work till die like Chineses (996) and got the objective done, now they say "well done" If that objective/key result can be never done, they may say "your objective is not archived, no promotion, no bonus, good luck next time"

I'm 30, male, 5.2ft, 170lbs (BMI: 30.5). I'm trying to control my weight by consuming 2200~2500 calories perday through 3 meals.
The problem is I feel too hungry, too often. I eat breakfast at 7:30AM but about 10:30 AM I feel very hungry. I eat lunch at 12:30 and about 15:00 I feel that I could eat a whole elephant. I eat dinner at 19:00 and about 21:00 I can't sleep without at least 2 slides of sandwiches. So, is there any tips to overcome the hungry!?

@longtth
longtth / dotnet-core-question.md
Last active June 23, 2019 08:53
for Quora question Why Microsoft don't make .NET Core simple to just a MainClass.cs file and a void Main(){}?

Not to mention about Python mess, with print("hello") in commandline.
Let say with Java, you just need a MainClass.java with void Main() {} and the compiler know what to do.
But with Csharp, even with .NET Core, we must dotnet new console -n DemoApp then we have 2 files: DemoApp.csproj and Program.cs for a simple Hello World program to run.
It would be better if dotnet.exe could help run directly in a folder with a Program.cs file like:

dotnet run .

it will be better for quick demo in college, when we back to the industry, let them learn to use *.csproj later

'Export unicode text by Pagination.com
'is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
'http://creativecommons.org/licenses/by-nc-sa/4.0/
'
'Based on a work at pagination.com.
Public Const AUTO_SAVE = False
Public Const AUTO_SAVE_SECONDS = 0
Public Const AUTO_SAVE_MINUTES = 1
Public Const AUTO_SAVE_HOURS = 0