Skip to content

Instantly share code, notes, and snippets.

View lucduong's full-sized avatar
🎯
Focusing

Luc lucduong

🎯
Focusing
View GitHub Profile
@lucduong
lucduong / 1-setup.md
Created February 20, 2022 11:14 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDg7+iTiLom9shOyOHiuv1fEKJeW8+uo+0IGlRVWjO14seX2LTz4zInoB+70OPJh0y49shJMOwOIN0gM2kFCr8bTt+e2n/nKGyQosqX4aEKrMkTZ3pKhrcruFmzlEjzqu7TEz70frxkXv0lS2mZcdvuRZJj9g+N5upEM+K9G30RLwrzgM055d6xlHKa8TNFfQ7E8WPJhYdLBpk442KMy4nSgq1z/J7okrIsfnBJ6DdyaqLV0Sffvuvte9ekopobDXwTcvidp138HaFvrqS3nbxGa/pOv7oxrOie2h7AelBZ9kxhFqlI6HJ2YPsUMUWmr4R0+70ZaVqkmCbJHGfsSa11rwl9UpN4tJKTaXVpVQ1FH3g+7ruUatUYqfKcHKSFV89Ami63XLSrIPH3cAfe0OmaBzbusAvKEXa4Z1eYeqsoOCIJLM9I0FX+caDDkwddMRfeRiJyLDFZnhDEaBxV81xO6aKSweVDdSVT34a5mlPbYIT7WTh7o9B2PIkK6W3s8dRrZl2qEvrONPhgmlfxLOBz3Ltx9Jh0Xnbls/gjZbznafzQk3MXLUTmb0OhnG1zKsHXHX4Kk2KMa7s7X6P5TWISiFiLwR3QCMh4ie6H7tVWpImnXZ5Qw8086C/TzWZ81EQz5NZ7z8WBFtBKoUCCffPdgYaI4BoS2WWWVkj8/P4YDQ== AWSReservedSSO__Cplus-PowerUserWithoutProd_3c6da137e4a07dc7+252760777274@cloud9.amazon.com
@lucduong
lucduong / sed cheatsheet
Created April 4, 2021 23:45 — forked from freewind/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@lucduong
lucduong / package.json
Created March 27, 2021 12:57
Tôi học nodejs như thế nào
{
"name": "demo-nodejs",
"version": "1.0.0",
"description": "Demo NodeJS",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Luc Duong",
"license": "MIT"
@lucduong
lucduong / CacheComposer.ts
Created March 22, 2021 23:24 — forked from abdavid/CacheComposer.ts
Cache composing in MoleculerJS
/**
POC of cache composing.
The idea behind this madnes was to compose multiple layers of LRU type caches,
with the first layer being local (LRUMemcache) with a 1:1 with configured TTL, and for each subsequent tier 1:n of the configured ttl.
In effect that would mean that when a cached item gets shifted out of the first layer due to being regarded as the least recently used,
it would still exising in the second layer giving it a grace period of sorts before deleting the cache entry from all layers.
BUT WHY you may ask?
@lucduong
lucduong / dnsmasq.conf
Created July 3, 2020 10:53 — forked from ruanbekker/dnsmasq.conf
Tinkering with Loki, Promtail, Grafana, Prometheus, Nginx and Dnsmasq
log-queries
log-facility=/var/log/dnsmasq.log
no-resolv
server=8.8.4.4
server=8.8.8.8
address=/router/10.1.1.1
address=/server/10.1.1.2
@lucduong
lucduong / check_service_completed.sh
Last active August 14, 2019 04:10
Shell Snippets
check_service_completed() {
service_name=$1
state=$(docker service ps $service_name | awk 'FNR == 2 {print $6}')
if [ "$state" = "no such service: $service_name" ]; then
state="Complete"
fi
if [ "$state" = "Complete" ]; then
echo "Y"
else
echo "N"
@lucduong
lucduong / webpack-moleculer-service-plugin.js
Created July 24, 2019 16:22
webpack-moleculer-service-plugin
'use strict';
const path = require('path');
const fs = require('fs');
const YAML = require('yaml');
function WebpackMoleculerServicePlugin(options) {
options = options || {};
if (typeof options === 'string') {
this.options = { output: options };
@lucduong
lucduong / .gitconfig
Last active January 9, 2019 04:24
Git Config
[alias]
st = status
ci = commit -v
co = checkout
up = pull origin
info = remote -v
d = diff
df = diff
dfc = diff --cached
dc = diff --cached
@lucduong
lucduong / pm2_python.json
Created November 22, 2017 12:44
pm2 guide
{
"apps": [{
"name": "impactool",
"cwd": ".",
"args": [
"manage.py",
"runserver"
],
"env": {
},