Skip to content

Instantly share code, notes, and snippets.

# Install ucu4c via Brew
brew install icu4c
# Create relative symlinks for icu4c
brew link --force icu4c
# Install pyicu via pip
# Make sure ICU_VERSION matches the one you just installed
sudo ICU_VERSION=60.2 pip install pyicu
CREATE TEMP FUNCTION
cleanup(text
STRING
)
RETURNS
STRUCT <
key string,
value string>
LANGUAGE js AS """
return JSON.parse(text);
@infinex
infinex / tmux.conf
Last active July 21, 2020 02:04
tmux.conf
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
set -g history-limit 5000
set -g default-terminal "screen-256color"
set -g status-left-length 24
# remap prefix from 'C-b' to 'C-a'
@infinex
infinex / gist:1e0fda899d3192ac0c2dede34a9bf9ca
Last active November 24, 2020 16:01
manjaro deep learning installation
sudo mhwd -a pci nonfree 0300
pacman -S cuda cudnn
yaourt Ananconda
git clone https://github.com/fastai/fastai
cd fastai
conda-env create -f environment.yaml
build gcc 6
yay -S gcc6
@infinex
infinex / xtensorflow18macos.patch
Last active October 23, 2018 12:41
xtensorflow18macos.patch
diff --git a/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc b/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc
index 0f7adaf24a..934ccbada6 100644
--- a/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc
+++ b/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc
@@ -69,7 +69,7 @@ __global__ void concat_variable_kernel(
IntType num_inputs = input_ptr_data.size;
// verbose declaration needed due to template
- extern __shared__ __align__(sizeof(T)) unsigned char smem[];
+ extern __shared__ __align__(sizeof(T) > 16 ? sizeof(T) : 16) unsigned char smem[];
@infinex
infinex / config save
Created November 21, 2018 14:05
temp
clear mod1
clear mod4
keycode 64 =Super_L
keycode 133 = Alt_L
add mod1 = Alt_L
add mod4 = Super_L
! Unmap capslock
clear Lock
keycode 66 = Hyper_L
! Set mod3 to capslock
@infinex
infinex / surfingKeys.js
Last active November 24, 2018 13:27
surfingKeys config
mapkey('\\F', "Toggle fullscreen (YouTube)", ytFullscreen, {
repeatIgnore: true,
domain: /(youtube\.com)/i
});
function ytFullscreen() {
$('.ytp-fullscreen-button.ytp-button').click();
}
// 优酷搜索
addSearchAliasX('yk', 'youku', 'http://www.soku.com/search_video/q_', 's', 'http://tip.soku.com/search_tip_1?query=', function(response) {
@infinex
infinex / cloudSettings
Last active December 30, 2020 06:47
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-30T06:47:43.145Z","extensionVersion":"v3.4.3"}
@infinex
infinex / Makefile
Last active November 6, 2020 07:25
utils
DATA_DIR=./data
field_keywords=$(wildcard $(DATA_DIR)/field_keywords_*)
out_keywords=$(patsubst $(DATA_DIR)/field_keywords_%,out%.txt,$(field_keywords))
REAL_PATH=$(abspath $(DATA_DIR))
NN_FRAMEWORK_DATA=~/.nn_framework_Data
field_keyword=$(patsubst $(DATA_DIR)/field_keywords_%,$(DATA_DIR)/field_keywords_\%,$(word 1,$(field_keywords)))
## all: run command
all: $(out_keywords)
@infinex
infinex / dataloader.py
Last active April 10, 2020 15:46
torch
special_tok_ids = {}
for tok_name, tok_symbol in tokenizer.special_tokens_map.items():
idx = tokenizer.all_special_tokens.index(tok_symbol)
special_tok_ids[tok_name] = tokenizer.all_special_ids[idx]
class JigSawDataset(Dataset):
def __init__(self, data, special_tok_ids, is_training, targets=None):
self.special_tok_ids = special_tok_ids
self.is_training = is_training
if self.is_training: