View vectoradd.cu
__global__ void add_vectors(
const int* a,
const int* b,
int *c,
const int n)
{
const int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= n) return;
View matrixMul.cu
#include <stdio.h>
#include <assert.h>
#include <cuda_runtime.h>
template <int BLOCK_SIZE> __global__ void
matrixMulCUDA(float *C, float *A, float *B, int wA, int wB)
{
// Block index
int bx = blockIdx.x;
int by = blockIdx.y;
// Thread index
View update_hosts.sh
```
ipv6=$1
rm hosts*
cp /etc/hosts ./_backhosts
if [ $ipv6 == '6' ];then
wget https://github.com/lennylxx/ipv6-hosts/raw/master/hosts
else
wget http://googlehosts-hostsfiles.stor.sinaapp.com/hosts
fi
sudo mv hosts /etc/hosts
View cloudflare_email_decoder_python
```python
def decode(encode_email):
k = int(encode_email[:2], 16)
ans = ''
for i in range(2, len(encode_email)-1, 2):
a = int(encode_email[i:i+2], 16)
a ^= k
ans += chr(a)
print(ans)
View gist:eddd5bf354e44d0eb7df0c838535ba4a
package main
import (
"bytes"
"strconv"
)
func cf(a string) (s string) {
var e bytes.Buffer
r, _ := strconv.ParseInt(a[0:2], 16, 0)
View 匹配ls -l结果中的文件或文件夹名
linux下ll命令部分结果,以文件名有引号的特殊举例:
```
drwxr-xr-x 2 find find 4096 2月 15 13:10 "hello wo"
-rw-r--r-- 1 find find 0 2月 15 13:10 "list无名 fd"
```
匹配的正则表达式
```
[drwx-]{10}\s+?\d{1,2}\s+?\w+?\s+?\w+?\s+?\d+?\s+?[\d\w\u4e00-\u9fa5]+?\s+?\d+?\s+?[\d:]+?\s+?(.*)
```
同样对于ftp中的dir命令结果也是如此
View git ignore文件 android studio
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
View python判断字符串里的数字等
s为字符串
s.isalnum() 所有字符都是数字或者字母
s.isalpha() 所有字符都是字母
s.isdigit() 所有字符都是数字
s.islower() 所有字符都是小写