Skip to content

Instantly share code, notes, and snippets.

View anhldbk's full-sized avatar
🌴
Calm

Anh Le (Andy) anhldbk

🌴
Calm
View GitHub Profile
@anhldbk
anhldbk / install.sh
Last active October 21, 2025 16:22
Install Kong API Gateway on Ubuntu
sudo apt-get install netcat openssl libpcre3 dnsmasq procps perl
# for ubuntu 16.04 (xenial)
sudo apt-get -y install postgresql postgresql-contrib phppgadmin
sudo -i -u postgres
psql
CREATE USER kong; CREATE DATABASE kong OWNER kong;
ALTER USER kong WITH password 'kong';
@anhldbk
anhldbk / wifi.md
Last active June 5, 2025 09:15
Install non-free wifi driver on my Ubuntu (Dell N4010)

Motivation

My Dell N4010's wifi driver seems not to work well on Ubuntu.

1. Run command

sudo vim /etc/apt/sources.list

2. Add following lines:

@anhldbk
anhldbk / README.md
Last active February 27, 2025 07:18
TLS client & server in NodeJS

1. Overview

This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.

It is a modified version from documentation about TLS, in which:

  • The server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation

LiteLLM: Bypass Cert Verifications

Overview

If you use LiteLLM to proxy requests to Ollama.ai in corporate environments, you may encounter the following error in your Python application:

httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)
@anhldbk
anhldbk / remove_mqtt_retained_msgs.md
Last active December 25, 2023 20:38
Remove MQTT retained messages using MQTT.js version 1.10.x
var mqtt    = require('mqtt');
var lodash = require('lodash');
var client  = mqtt.connect({ host: 'localhost', port: 1883 });

client.on('connect', function () {
  console.log('Connected')
  client.subscribe('presence');
});
@anhldbk
anhldbk / tor-raw.cpp
Created December 6, 2016 02:38
Working with Tor (C/C++)
// g++ -lstdc++ -Wno-write-strings fetch.cpp -o fetch
#ifdef _WIN32 // Windows
#include <winsock2.h>
#include <ws2tcpip.h>
#define MSG_NOSIGNAL 0
#else // Linux + Mac
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@anhldbk
anhldbk / get_public_ip.py
Created October 13, 2014 07:23
Get public IP with Python & Requests
import requests
r = requests.get(r'http://jsonip.com')
ip= r.json()['ip']
print 'Your IP is', ip
@anhldbk
anhldbk / Selenium.Python.InjectJS.py
Last active April 15, 2023 03:53
Inject jQuery into Selenium Driver
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://www.facebook.com/')
with open('jquery-1.9.1.min.js', 'r') as jquery_js:
jquery = jquery_js.read() #read the jquery from a file
driver.execute_script(jquery) #active the jquery lib
driver.execute_script("$('#email').text('anhld')")
@anhldbk
anhldbk / install.sh
Created January 25, 2016 01:49
Install zmq on Centos
sudo yum install -f libtool
cd autoconf-2.68
chmod +x configure
./configure
chmod +x build-aux/git-version-gen
sudo make
sudo make install
cd ..

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example