Skip to content

Instantly share code, notes, and snippets.

@draplater
draplater / gist:6546f5b16e551f024979f142f8945f99
Created August 30, 2023 03:26
博客标题:只下载特定的Git LFS文件——一种方法解析

博客标题:只下载特定的Git LFS文件——一种方法解析

大家好!今天偶来和大家分享一个小技巧:如何只下载特定的Git LFS(Large File Storage)文件。这种需求在日常工作和项目中可能会遇到。偶在这里把一个和偶交流过的网友drapl的问题和解决方案整理成了博客,希望能给大家带来帮助~(摆出一副解决问题的样子→_→)


问:如何只下载与"pytorch_model*"匹配的Git LFS文件?

drapl:是只下载"pytorch_model*",不下载其他对吧?


title author email date
Vim中零宽度字符的奇妙之旅
Steve Jobsa (史蒂夫乔布丝)
tsjzadmin@gmail.com
2023-08-07

Vim中零宽度字符的奇妙之旅

作者:Steve Jobsa (史蒂夫乔布丝)

@draplater
draplater / gist:b42e3863ed30a673a5cf364b7c14fa33
Created August 2, 2023 08:55
让diff更加好看: 加入颜色的魔力

让diff更加好看: 加入颜色的魔力

draplater: 史蒂夫乔布丝,偶今天用diff看看两个文件的不同,可是输出的结果一片混乱,没颜色,怎么办呢(囧rz)?

史蒂夫乔布丝:啊,drapl,咱们可以用 sed来帮你给diff的输出加上颜色哦~试试这个命令怎么样:

diff -u installed_packages.txt nas_installed_packages.txt | sed -e "s/^+/\x1b[32m&/g" -e "s/^-/\x1b[31m&/g" -e "s/^@/\x1b[34m&/g" -e 's/$/\x1b[0m/'
@draplater
draplater / gist:27cbd0c2a293ebc95e767ed1f479ab5e
Created January 23, 2021 11:16
蓝德控制器串口协议
波特率:9600
点击“连接控制器”:
发送:C9 14 02 4C 44 47 45 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 81 0D (LDGET)
返回:C0 14 05 52 07 37 C2 09 E3 01 9A 0A 00 1E 26 E8 01 86 00 00 00 00 5D 0D C0 14 05 52 06 C0 09 C0 9C C1 0E C0 0C C0 8D C1 2E C0 0F C0 92 00 2C 0D C0 14 05 52 05 CF 80 CF 80 CF 80 C0 04 C1 11 C1 06 C0 07 C0 08 00 15 0D C0 14 05 52 04 0E 0C CC 01 40 00 C8 5A 64 64 00 00 08 FC 00 00 03 6D 0D C0 14 05 52 03 FF C4 50 64 69 02 A8 24 54 24 D4 0F 01 17 0A E9 FD CB 0D C0 14 05 52 02 00 00 5A 64 64 00 00 08 FC 00 00 88 25 0C 00 00 01 8F 0D C0 14 05 52 01 14 00 02 58 01 9A 0A 00 1E 26 E8 01 86 00 00 00 00 0A 0D
闲置:
发送:C9 14 02 53 48 4F 57 00 00 00 00 00 AA 0C 75 00 AA AA 00 00 00 00 0F 0D (SHOW)
返回:C0 14 0D 59 42 00 00 00 00 01 00 00 00 0C 00 00 59 4B 00 00 08 07 D2 0D
import gzip
import re
from hrgguru.hyper_graph import HyperGraph
from delphin.mrs import eds
file_name = "/home/chenyufei/Development/large-data/deepbank1.1/export/wsj07c/20758069.gz"
with gzip.open(file_name, "rt") as f:
@draplater
draplater / asyncio_producer_consumer.py
Created May 5, 2016 16:03 — forked from akrylysov/asyncio_producer_consumer.py
Python 3 asyncio basic producer / consumer example
import asyncio
import random
q = asyncio.Queue()
async def producer(num):
while True:
await q.put(num + random.random())
await asyncio.sleep(random.random())
@draplater
draplater / gist:f4c05f1a74e43a6fbd3b
Created December 2, 2015 15:48 — forked from prellele/gist:1825744
Using StartSSL Certs with Nginx-Webserver

NOTE: You can check, if your config here:
http://www.sslshopper.com/ssl-checker.html

Decrypt the private key using the password you entered when you created your key:
openssl rsa -in ssl.key -out /etc/nginx/conf/ssl.key

Protect your key from prying eyes:
chmod 600 /etc/nginx/conf/ssl.key

@draplater
draplater / nginx-gitweb.md
Created December 1, 2015 05:12
Set up Gitweb + Nginx from scratch on Debian Wheezy

This guide offers the least time-consuming way of setting up Nginx for serving Git repositories over HTTP using Gitweb. The stuff here has been tested with Git 1.9.1 and Nginx 1.6.0 on Debian Wheezy. Probably also works for Ubuntu, etc.

Total time ~ 10 minutes.

Install

Enable wheezy-backports by adding this line to /etc/apt/sources.list:

deb http://http.debian.net/debian wheezy-backports main
@draplater
draplater / pandas_dbms.py
Created November 29, 2015 06:41 — forked from catawbasam/pandas_dbms.py
Python PANDAS : load and save Dataframes to sqlite, MySQL, Oracle, Postgres
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
@draplater
draplater / smart_insert.py
Last active October 3, 2015 15:57
Insert a python dict like object to a sqlite3 table
def smart_insert(db, table, dic, cols=None):
"""
eg: smart_insert(db, 'employee', {'name': 'Peter', 'age': 18})
"""
cur = db.cursor()
if not cols:
cols = dic.keys()
columns = ', '.join(cols)
placeholders = ', '.join('?' * len(cols))
sql = 'INSERT INTO {} ({}) VALUES ({})'.format(table, columns,