Skip to content

Instantly share code, notes, and snippets.

View y1zhou's full-sized avatar
🦙
Protein design

Yi Zhou y1zhou

🦙
Protein design
View GitHub Profile
from itertools import islice
def next_n_lines(file_opened, N):
return [x.strip() for x in islice(file_opened, N)]
with open("samplefile", 'r') as f:
x = ""
while x != []:
@y1zhou
y1zhou / bench.sh
Created October 26, 2018 14:48 — forked from TimothyYe/bench.sh
Bench test script
#!/usr/bin/env bash
#
# Description: Auto test download & I/O speed script
#
# Copyright (C) 2015 - 2016 Teddysun <i@teddysun.com>
#
# Thanks: LookBack <admin@dwhd.org>
#
# URL: https://teddysun.com/444.html
#
@y1zhou
y1zhou / user.js
Created December 5, 2019 17:58
Edge style smooth scrolling for FireFox
pref("general.smoothScroll.mouseWheel.durationMinMS", 50);
pref("general.smoothScroll.mouseWheel.durationMaxMS", 150);
pref("general.smoothScroll.currentVelocityWeighting", 0);
pref("general.smoothScroll.stopDecelerationWeighting", 0.82);
pref("mousewheel.default.delta_multiplier_y", 200);
pref("mousewheel.min_line_scroll_amount", 25);
@y1zhou
y1zhou / index.algolia.json
Created June 26, 2020 18:04
Hugo template for generating json file for Algolia
{{/* $index is an array of json objects that we'll submit to Algolia */}}
{{ $index := slice }}
{{ range site.RegularPages }}
{{ $page := . }}
{{/* Split long posts into 1000-word chunks for less noise in results */}}
{{ $chunked := slice }}
{{ $post_len := len .PlainWords }}
{{ range $i := (seq 0 1000 $post_len) }}
{{ $chunked = $chunked | append (delimit (first 1000 (after $i $page.PlainWords) ) " " ) }}
@y1zhou
y1zhou / yeast2human.py
Created November 9, 2020 21:17
Yeast gene symbols to human homologs
import numpy as np
import pandas as pd
import requests
# Interested genes
df = pd.read_excel("yeast_genes.xlsx")
pom_genes = df["Schizosaccharomyces pombe"][
df["Schizosaccharomyces pombe"].notnull()
].tolist()
cer_genes = df["Saccharomyces cerevisiae"][
@y1zhou
y1zhou / markdown.snippets
Last active April 30, 2021 03:05
RStudio Rmarkdown snippets
# \begin{}...\end{}
snippet begin
\begin{${1:env}}
${2}
\end{$1}
# Align(ed)
snippet ali
\begin{align${1:ed}}
${2}
\end{align$1}
@y1zhou
y1zhou / .pre-commit-config.yaml
Created January 29, 2023 10:07
Python pre-commit config
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# list of supported hooks: https://pre-commit.com/hooks.html
- id: trailing-whitespace
- id: end-of-file-fixer
@y1zhou
y1zhou / generate_slideshow.sh
Created February 2, 2023 08:50
Generate an mp4 slideshow from png images
ffmpeg \
-framerate 1 \
-pattern_type glob \
-i '*.png' \
-c:v libx264 \
-vf 'pad=ceil(iw/2)*2:ceil(ih/2)*2' \
-pix_fmt yuv420p \
slideshow.mp4
@y1zhou
y1zhou / build_docker.sh
Created June 30, 2022 15:17
EasyConnect Docker build script for M1 Macs
git clone -b thread_reuse https://github.com/hagb/docker-easyconnect.git
cd docker-easyconnect
git submodule update --init --recursive
docker image build -f Dockerfile.compile -t compile .
EC_VER=7.6.7 # 替换成需要的版本
DOCKER_USERNAME="your-name"
docker image build \
--build-arg EC_URL=$(cat ec_urls/${EC_VER}.txt) \
-t "${DOCKER_USERNAME}/docker-easyconnect:${EC_VER}-aarch64" \