Skip to content

Instantly share code, notes, and snippets.

View NothingCtrl's full-sized avatar

Thang Duong Bao NothingCtrl

View GitHub Profile
@NothingCtrl
NothingCtrl / serve.go
Created April 4, 2023 02:24 — forked from paulmach/serve.go
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@NothingCtrl
NothingCtrl / video_merge.py
Created December 17, 2022 18:20
Scan and merge (concatenation) video using FFMPEG
# python 3.6+
# --- CONCATENATION VIDEO FILES WITH FFMPEG ---
# Scan video by prefix then join to one file using FFMPEG
# tested on Windows OS only, FFMPEG must callable in CMD (add it to OS PATH)
#
# example usage:
# we have a video folder with files: video.mp4, video_01.mp4, video_02.mp4... (all file are same format and named with order)
#
# then, call this script to join these file:
# python video_merge.py video.mp4
@NothingCtrl
NothingCtrl / google_photo_takeout_restore.py
Last active November 21, 2022 12:02
Google Photo Takeout Restore To Local storage
# python 3.9
# === GOOGLE PHOTO TAKEOUT RESTORE ===
#
# --- REQUIRED PACKAGES ---
# - tzdata
# - filedate
#
#`--- FEATURES ---
# - Remove file existed in Album folder
# - Set image/video created date based on .json data file or file name
@NothingCtrl
NothingCtrl / xclaim_router_reboot.py
Created August 23, 2022 15:25
Python script to reboot XClaim router
# Install requests: pip install requests
# ---
# This script using to reboot XClaim router (tested with model: Xi-2)
# Author: thang[at]camratus.com
import requests
import os
import time
from urllib3.exceptions import InsecureRequestWarning
@NothingCtrl
NothingCtrl / vnexpress_vcar_crawl.py
Created August 15, 2022 09:37
vnExpress crawl v-car data to html file
# Crawl vnExpress.net v-car data
# required packages: html_to_json
from typing import Optional
import html_to_json
import html
import requests
import datetime
import logging
import os
@NothingCtrl
NothingCtrl / python_user_auth_check_with_active_directory.py
Created May 13, 2022 10:20
Test auth account with LDAP / Active Directory server
import sys
import ldap
import os
DEFAULT_SERVER = os.getenv("LDAP_SERVER") if os.getenv("LDAP_SERVER") else "127.0.0.1"
LDAP_PORT = os.getenv("LDAP_PORT") if os.getenv("LDAP_PORT") else "389"
LDAP_PROTOCOL = "ldaps" if os.getenv("LDAP_PROTOCOL") in ('1', 'true', 'True', 't') else "ldap"
def check_authenticate(address, username, password) -> bool:
try:
@NothingCtrl
NothingCtrl / pointer_convert_example.go
Created April 26, 2022 18:15
Example convert pointer type in Go
package main
import (
"fmt"
"strconv"
)
func main() {
var aa *int
var bb *string
@NothingCtrl
NothingCtrl / redmine_admin.py
Created April 19, 2022 10:12
Redmine DB Admin Tools, allow call with dynamic function name
# -*- coding: utf-8 -*-
# python version 3.5
import os
import json
import sys
import traceback
import ast
import inspect
from functools import partial
@NothingCtrl
NothingCtrl / _git_push_all.bat
Created March 24, 2022 04:22
(Windows) Bat script template to merge and push all branch: dev, staging, master
@echo OFF
rem https://patorjk.com/software/taag/#p=display&c=echo&f=Small%20Slant&t=GIT%20PUSH
echo _______________ ___ __ ________ __
echo / ___/ _/_ __/ / _ \/ / / / __/ // /
echo / (_ // / / / / ___/ /_/ /\ \/ _ /
echo \___/___/ /_/ /_/ \____/___/_//_/
set "dummy="
set /p DUMMY=Hit ENTER to continue...
@NothingCtrl
NothingCtrl / miner_process_kill_py27.py
Created February 16, 2022 11:04
Kill process of Kinsing miner virus
# -*- coding: utf-8 -*-
# Create: 16-02-2022 for Python 2.7
# Author: nothingctrl (nothingctrl@gmail.com)
# ---------------------------------------------------------------------------------------------------------------------
# Detect mail server (Zimbra) inject by miner virus name `kinsing`
# this virus use all CPU resource and have some behaviour:
# - Create a crontab as zimbra to download .sh script using wget
# - Download / create execute file in /var/tmp, /tmp, /opt/zimbra/log/
# - Run process with name: `kinsing...`, `kdevtmpfsi...`
# - In log file `/opt/zimbra/log/zmmailboxd.out`, every time virus file create, have a log: `/opt/zimbra/log/kinsing...`