Skip to content

Instantly share code, notes, and snippets.

@iydon
iydon / ctex-fontset-sustech.def
Created October 18, 2021 14:03
配置 sharelatex.cra.moe 字体(不知道具体字体名称,所以抑制了 `no-script "CJK"` 警告)
% https://sikouhjw.gitee.io/2021/02/14/2021-02-14-fontset-overleaf/
% https://www.overleaf.com/latex/templates/using-the-ctex-package-on-overleaf-zai-overleafping-tai-shang-shi-yong-ctex/gndvpvsmjcqx
% https://zhuanlan.zhihu.com/p/145429470
\GetIdInfo$Id: ctex.dtx 81d4c90 2020-10-19 20:24:58 +0800 Qing Lee <sobenlee@gmail.com> $
{SUSTech fonts definition (CTEX)}
\ProvidesExplFile{ctex-fontset-sustech.def}
{\ExplFileDate}{2.5.5}{\ExplFileDescription}
\RequirePackage{xpatch}
\xpatchcmd \fontspec_new_script:nn
{ \__fontspec_warning:nxx }
@abc1763613206
abc1763613206 / bvtest.py
Last active July 15, 2024 09:28
BVID Validate
import requests
import json
import random
Back_URL = 'https://api.bilibili.com/x/web-interface/archive/stat?aid='
headers = {
'Cookie': "Replace Me With REAL COOKIE" ,
'Pragma': 'no-cache',
@codehacken
codehacken / hclustering.py
Created July 27, 2017 20:01
Agglomerative clustering using Scikit-Learn (with a custom distance metric)
"""
Hierarchial Clustering.
The goal of gist is to show to use scikit-learn to perform agglomerative clustering when:
1. There is a need for a custom distance metric (like levenshtein distance)
2. Use the distance in sklearn's API.
Adapted from: sklearn's FAQ.
http://scikit-learn.org/stable/faq.html
"""
@NLKNguyen
NLKNguyen / install.sh
Created February 14, 2017 10:38
Install Hadoop on Ubuntu 16.04
# Copy line by line and paste to an interactive shell
# Update system
sudo apt-get update && sudo apt-get dist-upgrade
# Install Java
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@subchen
subchen / git-stash.md
Created October 31, 2014 08:56
Git Stash 用法

git stash用于保存和恢复工作进度

  • git stash

    保存当前的工作进度。会分别对暂存区和工作区的状态进行保存

  • git stash save "message..."

这条命令实际上是第一条 git stash 命令的完整版

@aa65535
aa65535 / ss-install.md
Last active April 7, 2024 13:03
shadowsocks-libev install at Debian or CentOS

Debian

cd /tmp
# 编译环境准备&安装依赖包
apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev libpcre3-dev asciidoc xmlto git
# 克隆源码
git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
@fxsjy
fxsjy / SimpleAuthServer.py
Created April 26, 2013 06:23
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
@econchick
econchick / gist:4666413
Last active December 22, 2023 13:32
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
@rswofxd
rswofxd / Netflow.py
Created May 25, 2012 09:58
Python:网卡流量统计实现
#coding:utf-8
import re,time
def get_net_info():
flow1 = open('/proc/net/dev')
lines = flow1.read()
flow1.close()
e = re.compile('(eth.)')
r_re = re.compile('eth..(.*?\s)')