Skip to content

Instantly share code, notes, and snippets.

@lixiaoquan
lixiaoquan / char.py
Created November 22, 2023 03:44
Decode special characters in Cygwin path
ss = "\uf03a"
print(f"Unicode char used by cygwin to represent : in path {ss} {[ss]}")
value = ord(ss)
print(f"Convert it to hex number {(hex(value))}")
# https://cygwin.com/cygwin-ug-net/using-specialnames.html
value -= 0xf000
@lixiaoquan
lixiaoquan / install_docker_ubuntu_16.04.sh
Last active December 3, 2021 07:30 — forked from gauravkaila/install_docker_ubuntu_16.04.sh
Install Docker and nvidia-docker on Ubuntu-16.04
#!/bin/bash
# add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add the Docker repository to APT sources
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# update the package database with the Docker packages from the newly added repo
sudo apt-get update
@lixiaoquan
lixiaoquan / gist:1c83db5915a35f0b665104b74488337b
Last active November 8, 2021 03:17
Install fzf for PC without Internet

首先在外网安装一个fzf

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

复制安装好的fzf到内网

~/.fzf

在内网中安装

@lixiaoquan
lixiaoquan / gist:c59b2c66d86ca7472cdcd960e290b741
Last active May 12, 2021 00:33
Example to understand EmbeddingBag
import torch
import torch.nn.functional as F
# an Embedding module containing 10 tensors of size 3
# fill with value which makes it easy to see how calculation is done
embedding_matrix = torch.tensor([[1.0, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11, 12],
@lixiaoquan
lixiaoquan / protobuf.md
Last active March 9, 2021 04:06
Solve too large protocol message

Error

When use ParseFromString(), protobuf reports

"[libprotobuf ERROR google/protobuf/io/coded_stream.cc:207] A protocol message was rejected because it was too big (more than 67108864 bytes). To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h."

Environment

  • System ubuntu 18.04
  • Python 3.6.9

Solution