Skip to content

Instantly share code, notes, and snippets.

@vuon9
vuon9 / settings.json
Created January 31, 2022 04:27
Go (golang) - editor.tokenColorCustomizations vscode settings
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
//following will be in italic (=FlottFlott)
"comment",
"entity.name.type.class", //class names
"keyword", //import, export, return…
"constant", //String, Number, Boolean…, this, super
@vuon9
vuon9 / gpg_git_signing.md
Created November 12, 2021 14:19 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
@vuon9
vuon9 / README.md
Last active February 19, 2025 05:15
Powertoys - Keyboard Manager - Common macOS keys mapping

How to install

  • cd C:\Users\${username}\AppData\Local\Microsoft\PowerToys\Keyboard Manager
  • Backup file existing one of default.json
  • Download default.json and add it to the current folder

Mapped keys

key
Esc
@vuon9
vuon9 / gilded-rose-original.go
Created May 14, 2021 16:54
GildedRose Refactoring Kata in Go
package main
func UpdateQualityOld(items ...*Item) {
for i := 0; i < len(items); i++ {
if items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert" {
if items[i].quality > 0 {
if items[i].name != "Sulfuras, Hand of Ragnaros" {
items[i].quality = items[i].quality - 1
}
@vuon9
vuon9 / slackymous.css
Last active December 14, 2020 08:51
Slackymous - Stylish CSS script for "URLs on the domain: app.slack.com"
body {
font-family: Arial, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.c-avatar, .c-avatar--interactive {
display: none;
}
@vuon9
vuon9 / json_extract_c.sql
Created November 9, 2020 06:49
JSON_EXTRACT_C func for parsing json string in mysql
DELIMITER $$
DROP FUNCTION IF EXISTS `json_extract_c`$$
CREATE FUNCTION `json_extract_c`(
details TEXT,
required_field VARCHAR (255)
) RETURNS TEXT CHARSET utf8
BEGIN
SET details = TRIM(LEADING '{' FROM TRIM(details));
@vuon9
vuon9 / main.go
Last active November 25, 2020 18:09
Try to censore content in JSON properties by Regex
package main
import (
"encoding/json"
"fmt"
"time"
"github.com/dlclark/regexp2"
"github.com/gin-gonic/gin"
)
@vuon9
vuon9 / .golangci.yml
Last active June 5, 2020 07:51
golangci-lint sample yml configuration
linters:
disable-all: true
enable:
- deadcode
- dupl
- errcheck
- gocritic
- gocognit
- gosimple
- govet
@vuon9
vuon9 / main.go
Created March 29, 2020 17:52 — forked from cespare/main.go
Example of testing Go HTTP servers using httptest.Server.
package main
import (
"log"
"myserver"
"net/http"
)
const addr = "localhost:12345"
@vuon9
vuon9 / jsconfig.json
Last active March 8, 2020 16:07
VSCode mapping import path to component
{
"compilerOptions": {
"jsx": "react",
"target": "ES6",
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"paths": {
"@app/*": ["app/*"],
"@internals/*": ["internals/*"]
}