Skip to content

Instantly share code, notes, and snippets.

View yifan's full-sized avatar

Yifan Zhang yifan

View GitHub Profile
@yifan
yifan / submit.sh
Created May 26, 2025 12:24
submit jobs when others don't use slurm
#!/bin/bash
# Submit a multinode training slurm job safely
# Check if a script is provided as argument
if [[ -z "$1" ]]; then
echo "Usage: $0 <slurm_script.sh>"
exit 1
fi
@yifan
yifan / migrate.py
Created February 27, 2025 18:43
script to deploy tmp deployment
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pyyaml",
# ]
# ///
""" migrate.py: Migrate a deployment to a new deployment
Usage:
@yifan
yifan / commit-emoji.md
Created January 25, 2021 10:33 — forked from silencesys/commit-emoji.md
List of emoji for git commits.

Git Commit Message

All Git Commit Messages MUST meet with this Text Format:

:emoji: Subject
(Only One NewLine)
Message Body
(Only One NewLine)
Ref &lt;###&gt;
@yifan
yifan / cleanrepo.sh
Created January 14, 2021 09:47
keep only 10 recent image in azure container registery
# keep only 10 recent images for any repository in azure container registry
REGNAME=meganews
az acr repository list -n meganews -o tsv | while read REPNAME; do
NUMIMAGES=$(az acr repository show-tags --repository $REPNAME -n $REGNAME -o tsv --orderby time_desc | wc -l)
if [[ $NUMIMAGES -gt 0 ]]; then
NUMREMOVE=$((NUMIMAGES - 10))
az acr repository show-tags --repository $REPNAME -n $REGNAME -o tsv --orderby time_desc | tail -$NUMREMOVE | while read TAGNAME; do
az acr repository delete -n meganews -t $REPNAME:$TAGNAME -y --verbose
done
fi
We have a transcription service for Al Jazeera. It pulls information of last 100 videos Al Jazeera
has uploaded every x seconds, and for any video we haven’t process, run speech recognition (see it
one component) on it, store the results to database. Design a fail-safe architect using any technology
you are familiar with.
@yifan
yifan / osx-10.9-setup.md
Created September 22, 2016 08:32 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

@yifan
yifan / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# 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.
@yifan
yifan / gist:d081cf53c6112e77f025
Created February 2, 2015 13:43
buckwalter utf8 conversion
# buckwalter unicode conversion
_unicode = u"\u0622\u0624\u0626\u0628\u062a\u062c\u06af\u062e\u0630\u0632\u0634\u0636\u0638\u063a\u0640\u0642\u0644\u0646\u0648\u064a\u064c\u064e\u0650\u0652\u0670\u067e\u0686\u0621\u0623\u0625\u06a4\u0627\u0629\u062b\u062d\u062f\u0631\u0633\u0635\u0637\u0639\u0641\u0643\u0645\u0647\u0649\u064b\u064d\u064f\u0651\u0671"
_buckwalter = u"|&}btjGx*z$DZg_qlnwyNaio`PJ'><VApvHdrsSTEfkmhYFKu~{"
_forwardMap = {ord(a):b for a,b in zip(_unicode, _buckwalter)}
_backwardMap = {ord(b):a for a,b in zip(_unicode, _buckwalter)}
#!/usr/bin/env python
import socket
import struct
import array
def send_packet(s, size, sample):
""" send a packet of samples of size to server
"""