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
CC = clang | |
MUPDF_VERSION = 1.23.11 | |
CFLAGS = -Wall -O3 \ | |
-I/usr/local/Cellar/mupdf/$(MUPDF_VERSION)/include \ | |
-L/usr/local/Cellar/mupdf/$(MUPDF_VERSION)/lib \ | |
-lmupdf-third -lmupdf | |
muconvert_stdout: muconvert_stdout.c | |
$(CC) $(CFLAGS) -o $@ $< |
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
from collections import Counter | |
from typing import Dict, Union, List | |
import numpy as np | |
from scipy import sparse | |
import pandas as pd | |
import spacy | |
from sklearn.datasets import fetch_20newsgroups | |
from sklearn.decomposition import LatentDirichletAllocation | |
from gensim.models.coherencemodel import CoherenceModel |
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
# replace 'your_user_name' with your user name | |
account [email protected] | |
host smtp.sina.com | |
port 465 | |
tls on | |
tls_starttls off | |
auth on | |
user your_user_name | |
from [email protected] | |
# paste your authentication code (客户端授权码) here, |
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 json | |
import sys | |
import requests | |
tl, query = sys.argv[1:] | |
sl = 'auto' | |
ua = ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) ' | |
'Gecko/20100101 Firefox/109.0') | |
query = query.strip() |
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
# Paste this script to "Alfred Preference > Advanced > Terminal", | |
# selecting "Application" to "Custom". | |
# | |
# In addition, create an iTerm2 profile with string "Alfred" in its Name, | |
# for example, "Working with Alfred". | |
# | |
# The script below will open the first iTerm2 session with such profile, | |
# or create a new window with that profile if not found. The command | |
# will be executed there. |
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
def parse_crontab_field(acc_values: range, acc_names: dict, string: str): | |
""" | |
Parse a field of crontab from ``string``. | |
>>> values = range(1, 8) | |
>>> names = dict(zip(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'], | |
... values)) | |
>>> parse_crontab_field(values, names, '*') | |
[None] | |
>>> parse_crontab_field(values, names, '*/2') |
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
# Require: [`fd`](https://github.com/sharkdp/fd.git) | |
PATTERN='XXX' # Assume this would be a directory | |
fd -0 -td "$PATTERN" \ | |
| xargs -0 du -sh \ | |
| numfmt --from=auto --to=none \ | |
| perl -ane 'BEGIN { my $sum = 0; } $sum += $F[0]; print; END { print $sum, " totoal\n"; }' \ | |
| numfmt --from=none --to=si |
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
# -*- coding: utf-8 -*- | |
""" | |
Plot the convex hull around a set of points as a | |
shaded polygon. | |
@author: Nicolas Guarin Zapata and Kaiwen | |
@date: February 6, 2023 | |
""" | |
import numpy as np | |
from scipy.spatial import ConvexHull |
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
use warnings; | |
use strict; | |
use File::Basename qw(fileparse); | |
use File::Copy qw(cp mv); | |
###################################################################### | |
# Configuration # | |
###################################################################### |
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
#!/usr/bin/env python3 | |
def nums2ranges(nums): | |
""" | |
>>> list(nums2ranges([])) | |
[] | |
>>> list(nums2ranges([0, 1, 2, 3, 4])) | |
[slice(0, 5, None)] | |
>>> list(nums2ranges([0, 1, 4, 5, 6])) |
NewerOlder