Skip to content

Instantly share code, notes, and snippets.

View liviaerxin's full-sized avatar

Frank liviaerxin

  • ASTRI
  • Hong Kong
View GitHub Profile
@liviaerxin
liviaerxin / ssh.md
Created March 8, 2023 06:46
SSH Login Setup #ssh

SSH Login Setup

  1. Generate ssh key
# Generate ssh key with files(~/.ssh/id_rsa, ~/.ssh/id_rsa/pub) and username in default
ssh-keygen -t rsa

# Generate ssh key with specified files and username
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
@liviaerxin
liviaerxin / app_lock.py
Created March 3, 2023 07:42
Limit only 1 request in a endpoint at a time #python
#main.py
from fastapi import FastAPI
import asyncio
app = FastAPI()
lock = asyncio.Lock()
counter = 0
@app.post('/limit')
@liviaerxin
liviaerxin / simple_vpn_server_setting.md
Last active March 8, 2023 06:50
Simple VPN Server #vpn

VPN Server Setting

ocserv

# 
docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d tommylau/ocserv
# set username/password
docker exec -it ocserv ocpasswd -c /etc/ocserv/ocpasswd -g "Route,All" frank
# delete user
@liviaerxin
liviaerxin / XOpenGLRenderAnimation.cpp
Created July 28, 2022 04:18
Create X11 window rendering an animation using OpenGL
/**
* @file XOpenGLRenderAnimation.cpp
* @author your name (you@domain.com)
* @brief
* @version 0.1
* @date 2022-07-27
*
* @copyright Copyright (c) 2022
* https://github.com/gamedevtech/X11OpenGLWindow
clang++ XOpenGLRenderAnimation.cpp -o XOpenGLRenderAnimation \
@liviaerxin
liviaerxin / ping.py
Created June 9, 2022 07:45 — forked from pklaus/ping.py
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping
@liviaerxin
liviaerxin / dummy_thread.py #Python
Created May 20, 2022 01:55
Dummy thread to close gracefully
import threading
import time
import threading
import signal
class DummyThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self._running = True
@liviaerxin
liviaerxin / blog.md
Created April 16, 2022 17:38
gistlog #GistLog

hello gistlog