Skip to content

Instantly share code, notes, and snippets.

View Raibows's full-sized avatar
👀
Exploring

Chi Zuo Raibows

👀
Exploring
View GitHub Profile
@huchenxucs
huchenxucs / pos_embed.py
Created July 23, 2020 06:09
T5 relative positional embedding
import math
import torch
import torch.nn as nn
from torch.nn import functional as F
class RelativePositionBias(nn.Module):
def __init__(self, bidirectional=True, num_buckets=32, max_distance=128, n_heads=2):
super(RelativePositionBias, self).__init__()
self.bidirectional = bidirectional
@ihoromi4
ihoromi4 / seed_everything.py
Created February 5, 2020 11:49
pytorch - set seed everything
def seed_everything(seed: int):
import random, os
import numpy as np
import torch
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
@yougg
yougg / proxy.md
Last active June 20, 2024 00:39
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@klainfo
klainfo / ms.tex
Last active January 29, 2024 17:01
Upload LaTeX-generated pdf paper to arXiv without LaTeX sources
\documentclass[letter]{article}
\pdfoutput=1
\usepackage{hyperref}
\hypersetup{
pdfinfo={
Title={title},
Author={author},
}
}
\usepackage{pdfpages}
@KeithYeh
KeithYeh / Self-Signed SSL with SAN.md
Created October 14, 2017 13:12
Create self-signed SSL certificate with SubjectAltName(SAN)

How to create a self-signed SSL Certificate with SubjectAltName(SAN)

After Chrome 58, self-signed certificate without SAN is not valid anymore.

Step 1: Generate a Private Key

openssl genrsa -des3 -out example.com.key 2048

Step 2: Generate a CSR (Certificate Signing Request)