Skip to content

Instantly share code, notes, and snippets.

View longtth's full-sized avatar

Long NguyenX longtth

View GitHub Profile
@longtth
longtth / unLFS.py
Created September 5, 2023 13:25 — forked from tigerhawkvok/unLFS.py
Remove LFS from a directory
#!python3
"""
Remove LFS tracked files and change them to normal git
Python 3.8+, native code
For Python <= 3.7, move the Literal and Final imports from "typing" to third-party module "typing_extensions"
@author Philip Kahn
@url https://gist.github.com/tigerhawkvok/adb7905a2423312f237da1953d6a8eeb
@longtth
longtth / Count Code lines
Created May 2, 2023 16:56 — forked from amitchhajer/Count Code lines
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@longtth
longtth / remap-capslock-to-control-win10.md
Created August 2, 2022 15:39 — forked from joshschmelzle/remap-capslock-to-control-win10.md
Remap Caps Lock to Control on Windows 10

Ways to remap caps lock to control on Windows 10

These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).

Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.

Approach 1. Manually through regedit

Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.

@longtth
longtth / install_nvidia_docker_offline.md
Created August 26, 2021 14:17 — forked from lamhoangtung/install_nvidia_docker_offline.md
How to install nvidia-docker offline for Ubuntu 18.04
@longtth
longtth / global-gitignore.md
Created August 2, 2021 14:00 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@longtth
longtth / curl.md
Created June 24, 2021 14:28 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@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 / README.md
Created October 4, 2018 06:52 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@longtth
longtth / TextToImage.cs
Created July 1, 2018 08:51 — forked from naveedmurtuza/TextToImage.cs
Converting text to image (png) C#
/// <summary>
/// Converting text to image (png).
/// </summary>
/// <param name="text">text to convert</param>
/// <param name="font">Font to use</param>
/// <param name="textColor">text color</param>
/// <param name="maxWidth">max width of the image</param>
/// <param name="path">path to save the image</param>
public static void DrawText(String text, Font font, Color textColor,int maxWidth,String path)
{