Skip to content

Instantly share code, notes, and snippets.

@davidliyutong
davidliyutong / ClassTableToCS.py
Last active March 7, 2022 07:22
A script to convert class table to ICS format, designed for SJTU SPEIT curriculum.
# %%
from openpyxl import load_workbook
import pandas as pd
import numpy as np
import re
from icalendar import Calendar, Event, vText
from pytz import timezone
from datetime import datetime, timedelta
from typing import Tuple
@davidliyutong
davidliyutong / github-fast-clone.sh
Last active April 13, 2024 07:16
Accelerate github clone by using mirror
# Clone github repo
# Usage:
#
# $ chmod +x ./github-fast-clone.sh
# $ ./github-fast-clone <user/repo>
#!/bin/bash
MIRROR=https://hub.fastgit.org/
GIT_HTTP_CONNECT_TIMEOUT=60
DEPTH=3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
echo "PROMPT=%m\ \$PROMPT" >> .zshrc
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
import json
import os
import getpass
from typing import List, Tuple, Dict
EMAIL_SUBJECT = 'Notification of DM'
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import os
from credentials import USER_EMAIL, USER_PASSWD, PROJECT_URL
download_path = os.getcwd()
options = webdriver.EdgeOptions()
options.use_chromium = True
import os
import os.path as osp
import glob2
from typing import List, Dict
import argparse
import difflib
from io import StringIO
import coloredlogs, logging
import tqdm
import re
@davidliyutong
davidliyutong / test-0.py
Created June 15, 2022 16:09
Japanese Spelling Test
import random
import re
import numpy as np
import time
from pyrsistent import b
prononciation = ['a',
'i',
'u',
@davidliyutong
davidliyutong / rancher-url-change.md
Created August 22, 2022 14:36 — forked from janeczku/rancher-url-change.md
Change the hostname/URL and certificate of an existing Rancher installation

Steps to change the URL of Rancher installation and switch from a self-signed certificate to a certificate signed by recognized CA.

  1. Change the Rancher server-url setting to the new URL:
    • Navigate to https://<old_rancher_hostname>/g/settings/advanced
    • Edit server-url to https://<new_rancher_hostname>
  2. Clear the private CA certificate for the old certificate
    • Navigate to https://<old_rancher_hostname>/g/settings/advanced
    • Next to cacerts click context menu -> View in API
    • Click Edit
    • Clear the content of the value field
#!/bin/bash
# Copyright davidliyutong@sjtu.edu.cn
already_run=$(cat /root/.bashrc | grep "source /openbayes/home/.bashrc")
if test -n "$already_run"; then
echo -e '\n\n################ \n\nYou have already sourced /openbayes/home/.bashrc, no need to run restore-from-shutdown\n\n################ \n\n'
else
echo "source /openbayes/home/.bashrc" >> /root/.bashrc
echo -e '\n\n################ \n\nAppend /openbayes/home/.bashrc to /root/.bashrc, done !\n\n################ \n\n"
fi