This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import pandas as pd | |
from tqdm.auto import tqdm | |
from xml.dom import minidom | |
def get_version_history(package: str): | |
res_df = pd.DataFrame() | |
url = f"https://registry.npmjs.org/{package}" | |
res = json.loads(requests.get(url).text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run command and color print | |
import subprocess | |
import os | |
import sys | |
import logging | |
from typing import Dict, Optional, TextIO, Tuple | |
from io import StringIO | |
def run_command(command: str, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
def plot_mini_hist(data: pd.Series, log_scale=False, xlim=None): | |
""" | |
:param data: a pandas series containing the `original` data (not to be confused with stats) | |
:param log_scale: plot x-axis in log scale (optional, default=False) | |
:param xlim: limit the range of x-axis, e.g. [-100, 300] (optional, default=None) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off&cd\&color 0a&cls | |
reg add "HKLM\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d PhotoViewer.FileAssoc.Tiff /f | |
reg add "HKLM\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d PhotoViewer.FileAssoc.Tiff /f | |
reg add "HKLM\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d PhotoViewer.FileAssoc.Tiff /f | |
reg add "HKLM\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d PhotoViewer.FileAssoc.Tiff /f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################### | |
# To Run this script hourly, you need to add the following cron job: | |
# crontab -e | |
# | |
# Add the following line: | |
# 0 * * * * /path/to/check-server-status.sh | |
# | |
# Then save and exit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run func(args) concurrently and aggregate the results | |
# author: @hehao98 <heh@pku.edu.cn>, @12f23eddde <12f23eddde@gmail.com> | |
from typing import Callable, Iterable, Optional, Any, Tuple, TypeVar, Union | |
import time | |
import traceback | |
from multiprocess import Pool, cpu_count | |
from tqdm.auto import tqdm | |
import pandas as pd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Capture: http://www.cpcelc.pku.edu.cn/phone/socket.php?apistr=XXXXX | |
OPERID="XXXXXXXXXXXXXXXXXXXXX" | |
# Reading Log | |
READING_LOG="/tmp/eletribot.log" | |
LOW_THRESHOLD=10 | |
# Serverchan sendkey https://sct.ftqq.com/ | |
SCKEY="YYYYYYYYYYYYYYYYYYYYYYY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import zipfile | |
import requests | |
repo_name = input("Enter 4open.science repository name: ") | |
api_url = f"https://anonymous.4open.science/api/repo/{repo_name}/files/" | |
r = requests.get(api_url) | |
r.raise_for_status() | |
r_j = r.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is used to create a new user on the local system. | |
# You will be prompted to enter the username (login), the person name, and a password. | |
# The username, password, and host for the account will be displayed. | |
# Make sure you execute the script with superuser privileges. | |
# If you do not supply at least one argument, then you will be prompted for the value. | |
# Run the script like this: | |
# sudo ./add-local-user.sh USERNAME [AUTHORIZED KEYS]... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET input_format_null_as_default = 1; | |
SET input_format_allow_errors_num = 100000; | |
SET input_format_allow_errors_ratio = 0.1; | |
SET date_time_input_format = 'best_effort'; | |
CREATE DATABASE IF NOT EXISTS `ghtorrent`; | |
DROP TABLE IF EXISTS `ghtorrent`.`organization_members` ; | |
CREATE TABLE `ghtorrent`.`organization_members` ( |
OlderNewer