Skip to content

Instantly share code, notes, and snippets.

View shanenoi's full-sized avatar
🚧
building my own culture

Shane Nguyễn shanenoi

🚧
building my own culture
View GitHub Profile
@shanenoi
shanenoi / Searching.go
Last active July 19, 2021 18:52
Find Substring Using Levenshtein Distance
package main
import (
"fmt"
"math"
"regexp"
)
var removePattern string = `(\s)`
var standarPatern string = ``
@shanenoi
shanenoi / locate.sh
Created August 19, 2020 13:42
Tại sao lại phải install Mlocate 🦧 trong khi chúng ta có thể code được chức năng chính của nó 🤯 Tốc độ thì không gọi là quá chậm 🦛🐷🐮
update_data () {
printf "[+] Update Data, Please Wait!\n"
rm ~/..locate_*
sudo find />~/..locate_$(date +%s) 2>/dev/null
exit 0
}
if [ "$1" = "--update" ];
then
update_data
@shanenoi
shanenoi / HowToBuildJarFile.sh
Created August 18, 2020 10:26
Tìm hiểu Java khá lâu rồi nay mới biết cách build file jar bằng command :)
FILE=hello_world
CONTENT=$(cat <<-END
public class $FILE {
public static void main(String[] args) {
System.out.println(
"Excuse me, what the fuck!\\\n" +
"U dont know how to build jar by command?"
);
}
}
@shanenoi
shanenoi / .bashrc
Last active September 14, 2020 03:30
Đây là cái bashrc của mình 😆
# ......... append these lines into your bashrc file ......... #
# run schedule.sh
if [ -f $HOME/schedule.sh ]; then
echo " __________"
echo -e "}~~~~[ SCHEDULE ]"
echo " ▔▔▔▔▔▔▔▔▔▔"
. $HOME/schedule.sh
fi
@shanenoi
shanenoi / cpu_ram.py
Last active July 31, 2020 01:59
hiện thông số hoạt động của máy tính lên wallpaper (cpu, ram, ....)
# python3 -m pip install psutil
# python3 -m pip install opencv-python
import cv2
import copy
import os
import psutil
import time
import shutil
@shanenoi
shanenoi / server.py
Created June 21, 2020 10:15
Actually this file is /usr/lib/python3.8/http/server.py, but I want when i run `python3 -m http.server` and it will show lan ip insteal 0.0.0.0!
"""HTTP server classes.
Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see
SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST,
and CGIHTTPRequestHandler for CGI scripts.
It does, however, optionally implement HTTP/1.1 persistent connections,
as of version 0.3.
Notes on CGIHTTPRequestHandler
#include <cmath>
#include <string.h>
#include <iostream>
using namespace std;
class Integer {
public:
char* value[2] = { strdup("0"), strdup("+") };