Skip to content

Instantly share code, notes, and snippets.

View vietanhduong's full-sized avatar

Viet-Anh Duong vietanhduong

  • Hanoi, Vietnam
  • 17:08 (UTC +07:00)
View GitHub Profile
@vietanhduong
vietanhduong / dnsmasq OS X.md
Created December 19, 2024 13:55 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

apiVersion: pilot.kyber.network/v1alpha1
kind: PrivateIngress
metadata:
name: aggregator
spec:
domains:
- aggregator-api.core-cluster.gke.develop.internal
routes:
- name: ''
match:
@vietanhduong
vietanhduong / remove_release.py
Created October 8, 2021 04:05
Quick remove github release
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import os
import sys
import json
def err(msg, **kwargs):
print(msg, file=sys.stderr, **kwargs)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
import random
import re
import string
import sys
@vietanhduong
vietanhduong / GPG.md
Created April 15, 2021 17:51
How to trust a imported GPG key
$ gpg --edit-key <uid>
gpg> trust

Please decide how far you trust this user to correctly verify other 
users' keys (by looking at passports, checking fingerprints from 
different sources, etc.)
@vietanhduong
vietanhduong / gate_keeper.sh
Last active April 1, 2021 03:29
Gate Keeper
#!/bin/bash
RED='\033[0;31m'
GRN='\033[0;32m'
BLU='\033[0;34m'
NC='\033[0m'
PS3='Please enter your choice: '
options=("Disable Your GateKeeper" "Enable Your GateKeeper" "Allow Single App To ByPass The GateKeeper" "Quit")
select opt in "${options[@]}"
@vietanhduong
vietanhduong / vault-enc.sh
Last active March 4, 2021 07:37
Encrypt ansible variables
#!/bin/bash
set -e
VAULT=".vault"
trap "rm -f $VAULT" EXIT
#================
if ! command -v "ansible-vault" $> /dev/null; then
echo "Not found command 'ansible-vault'."
exit 1
@vietanhduong
vietanhduong / rules.v4
Created February 17, 2021 08:16
Iptables handle request into docker port
#/etc/iptables/rules.v4
# apply rules => iptables-restore < /etc/iptables/rules.v4
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:FILTERS - [0:0]
:DOCKER-USER - [0:0]
@vietanhduong
vietanhduong / Makefile
Created February 4, 2021 07:07
How to export .env file in Makefile
### `.env`
### TEST=ABC
###
test:
$(eval include .env)
$(eval export $(grep -v '^#' .env | xargs -0))
printenv TEST