Skip to content

Instantly share code, notes, and snippets.

View haixinsong's full-sized avatar

haixin haixinsong

  • macrosan
  • Shenzhen
View GitHub Profile
@haixinsong
haixinsong / combine.cpp
Created September 14, 2022 16:32
small combine function
#include <vector>
#include <string>
template <typename T>
void combineInner(const std::vector<T> &data, int start, int m, int depth, std::vector<T> &temp, std::vector<std::vector<T>> &result)
{
if (depth > m - 1)
return;
if (depth == m - 1)
@haixinsong
haixinsong / trans.py
Created September 5, 2022 14:32
simple file encode trans python tool
from os import listdir
from os import walk
from os.path import isfile,isdir,join
from chardet.universaldetector import UniversalDetector
# may need to `pip3 install chardet`
import codecs
detector = UniversalDetector()
# change the targetPath to your path
@haixinsong
haixinsong / .bashrc
Last active June 15, 2020 02:03
custom configuration for ~/.bashrc file
# CUSTOM MIRRORS
export HOST_IP=$(grep -oP '(?<=nameserver\ ).*' /etc/resolv.conf)
export PORXY_ADDR="http://$HOST_IP:1080"
# PROXY FOR APT
function proxy_apt() {
# make sure apt.conf existed
sudo touch /etc/apt/apt.conf
sudo sed -i '/^Acquire::https\?::Proxy/d' /etc/apt/apt.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
@echo off
SETX>nul http_proxy ""
SETX>nul https_proxy ""
SETX>nul all_proxy ""
SET http_proxy=
SET https_proxy=
SET all_proxy=
echo From now on directly connect to network
@echo on
REM proxy script for windows cmd/powershell
@echo off
SET proxy_addr=http://127.0.0.1:1080
SETX>nul http_proxy "%proxy_addr%"
SETX>nul https_proxy "%proxy_addr%"
SETX>nul all_proxy "%proxy_addr%"
SET http_proxy=%proxy_addr%
SET https_proxy=%proxy_addr%
REM https://blog.nediiii.com/jdk-windows-setup/
@echo off
:start
echo current JDK version:
java -version
echo.
echo =============================================
echo available JDK version:
@haixinsong
haixinsong / decimal-number-display-as-binary-number.cpp
Last active January 17, 2019 17:39
decimal number display as binary number
#include <iostream>
using namespace std;
int main()
{
int input_number, temp_number, display_number = 0, ten_power = 1;
cout << "please input a positive integer:" << endl;
cin >> input_number;
temp_number = input_number;
while (temp_number > 0)
{