Skip to content

Instantly share code, notes, and snippets.

View Hansimov's full-sized avatar

Hansimov

View GitHub Profile
@Hansimov
Hansimov / sync-github-repo-to-huggingface-space.md
Last active April 27, 2024 13:22
Sync Github repo to Huggingface space

Push Github Repo to Huggingface Space

Create a huggingface token

Put it in the repo secrets with name like HF_TOKEN in related Github repo setitngs:

Run following commands in the git root folder:

@Hansimov
Hansimov / v2ray-setup.md
Last active April 25, 2024 14:31
Setup v2ray server (linux) and client (windows)
@Hansimov
Hansimov / extract_pdf_bookmarks.py
Last active April 12, 2024 15:52
Extract toc or bookmarks from pdf
#%%
from PyPDF2 import PdfReader
from iteration_utilities import deepflatten
class PdfTocProcessor:
def __init__(self):
self.fn = "新媒体蓝皮书2022 - 带书签.pdf"
self.reader = PdfReader(self.fn)
self.page_num = len(self.reader.pages)
self.outline = self.reader.outline
@Hansimov
Hansimov / install-python-without-sudo.md
Last active March 7, 2024 12:05
Install Python latest version in Linux without sudo access

See this link before you really want to install pure Python by yourself instead of miniconda:

Method 1: (Recommend) Use Pyenv

  • Note: If pyenv install <version> connect to python.org time out
    • Visit this secret gist to setup proxies: Hansimov/proxies.md

Download pyenv-installer and run it:

@Hansimov
Hansimov / npm-node-upgrade.md
Last active February 26, 2024 11:31
Upgrade versions of npm and node.js to latest

Update Node.js via nvm

Install nvm

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Run bash to restart terminal to make the execution path recognizable.

@Hansimov
Hansimov / set-system-date-time-ubuntu.md
Last active January 31, 2024 09:34
Set system date time from internet in ubuntu
@Hansimov
Hansimov / logger.py
Last active January 31, 2024 09:33
A script template of logger.py
import datetime
import functools
import inspect
import logging
import os
import shutil
import subprocess
from termcolor import colored
@Hansimov
Hansimov / .tmux.conf
Last active January 15, 2024 07:52
.tmux.conf
# TMUX Guide
# https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html#tmux-conf
# tmux(1) - Linux manual page
# https://man7.org/linux/man-pages/man1/tmux.1.html#FORMATS
# 256 Colors - Cheat Sheet - Xterm, HEX, RGB, HSL
# https://www.ditig.com/256-colors-cheat-sheet
# kill tmux process (if stuck) with following commands
# ps aux | grep tmux
# kill -9 <pid>
@Hansimov
Hansimov / install-docker.md
Last active January 5, 2024 18:34
Install and setup docker
@Hansimov
Hansimov / enable-arc-770-in-ubuntu.md
Last active December 19, 2023 09:42
Enable using Intel Arc 770 GPU in Ubuntu

List GPUs in machine

sudo lshw -C display
  *-display UNCLAIMED
       description: VGA compatible controller
       product: GP102 [TITAN Xp]