Skip to content

Instantly share code, notes, and snippets.

保存以下内容为print_cuda_arch.cu

#include <cstdio>
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

__device__ void print_arch(){
  const char my_compile_time_arch[] = STR(__CUDA_ARCH__);
 printf("__CUDA_ARCH__: %s\n", my_compile_time_arch);
@Roxbili
Roxbili / vsc_unable_to_watch_for_file_changes.md
Last active March 7, 2023 07:41
VS Code: Unable to watch for file changes in this large workspace folder. Please follow the instructions link to resolve this issue.

Docker用户

Docker这部分设置是继承主机的,因此以下流程需要在host侧去执行(需要管理员权限的,放弃吧!)

参考链接:coder/code-server#628

非Docker用户

由于linux系统允许用户监控文件的数量是有限制的,所以导致vscode无法监控文件数量很多的代码库,因此需要单独设置一下。

from multiprocessing import Pool
import numpy as np
import torch
import torch.nn as nn
torch.multiprocessing.set_start_method('forkserver', force=True)
# torch.multiprocessing.set_start_method('spawn')
def random_size():
"""
@Roxbili
Roxbili / readme.md
Last active March 5, 2022 05:43
Fiddler Everywhere capturing and inspecting iOS traffic

Fiddler Everywhere Config

  1. Downloads & Install
  2. Preference -> HTTPS -> Trust root certificate,then we can capture https url

image

  1. Preference -> Connections

image

IOS Config

  1. On your iOS device, go to Settings > WiFi.
@Roxbili
Roxbili / imagenet-1k-prepare.md
Last active January 8, 2022 07:43
prepare imagenet-1k dataset script

Prepare ImageNet-1K

To extract ImageNet dataset as following structure:

  train/
  ├── n01440764
  │   ├── n01440764_10026.JPEG
  │   ├── n01440764_10027.JPEG
  │   ├── ......
  ├── ......
@Roxbili
Roxbili / overleaf_vim.js
Last active January 16, 2024 00:45
Vim-mode in overleaf
// ==UserScript==
// @name Overleaf Editor VIM Keybindings settings
// @description Vim-mode in overleaf
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @match https://www.overleaf.com/project/*
// @match https://cn.overleaf.com/project/*
// @grant none
// Source 1: https://groups.google.com/d/msg/ace-discuss/gwXMzUM17I4/9B_acHBSCQAJ
// Source 2: https://www.overleaf.com/learn/how-to/How_can_I_define_custom_Vim_macros_in_a_vimrc_file_on_Overleaf%3F
@Roxbili
Roxbili / yhdm_no_add.js
Last active February 16, 2022 05:40
樱花动漫去广告
// ==UserScript==
// @name 樱花动漫去广告
// @namespace http://tampermonkey.net/
// @version 0.1.3
// @description 去除樱花动漫的广告,包括左侧、右侧、右下角、红包页面。未去除暂停界面的广告。(Safari不可用,原因未知)
// @author Roxbili
// @include *://*yhdm*
// @include *://*yinghuacd*
// @include *://*imomoe*
// @include *://*sakuradm*
@Roxbili
Roxbili / sort.md
Last active April 4, 2022 08:02
Python实现一个列表依赖于另一个列表的排序结果重新排序

List

list1, list2 = (list(t) for t in zip(*sorted(zip(list1, list2))))

Numpy

people = ['Jim', 'Pam', 'Micheal', 'Dwight']
ages = [27, 25, 4, 9]
@Roxbili
Roxbili / Ubuntu shadowsocks + privoxy + genpac 实现自动代理科学上网.md
Last active June 6, 2019 08:03
Ubuntu shadowsocks + privoxy + genpac 实现自动代理科学上网 + git 代理配置

方法一

客户端Shadowsocks-qt5

安装后可直接跳转第3步进行自动代理设置的步骤(未尝试过)。

方法二

1. Shadowsocks

初步安装

  • 更新软件源
sudo apt update