Skip to content

Instantly share code, notes, and snippets.

View zhanwenchen's full-sized avatar
🤠
Howdy y'all

Zhanwen Chen zhanwenchen

🤠
Howdy y'all
View GitHub Profile
"""
Extract the contents of a `run-{id}.wandb` database file.
These database files are stored in a custom binary format. Namely, the database
is a sequence of wandb 'records' (each representing a logging event of some
type, including compute stats, program outputs, experimental metrics, wandb
telemetry, and various other things). Within these records, some data values
are encoded with json. Each record is encoded with protobuf and stored over one
or more blocks in a LevelDB log. The result is the binary .wandb database file.
@zhanwenchen
zhanwenchen / dapply
Created December 6, 2024 20:29 — forked from cam8001/dapply
Apply a patch directly from a URL without downloading it first.
#!/bin/bash
# Downloads and applies a patch from Drupal.org.
if [ -z "$1" ]
then
echo "You need to supply a URL to a patch file."
exit
fi
URL=$1;
@zhanwenchen
zhanwenchen / PA profile-set astro-a50-gen4.conf
Created September 30, 2024 16:28 — forked from ktosiek/PA profile-set astro-a50-gen4.conf
Astro A50 support on Linux - basic configuration for PulseAudio 13 (tested on Ubuntu's 13.99.1). Install the files and reboot, to make sure udev and PA reloaded :-)
; /usr/share/pulseaudio/alsa-mixer/profile-sets/astro-a50-gen4.conf
[General]
auto-profiles = yes
[Mapping analog-voice]
description = Voice
device-strings = hw:%f,0,0
channel-map = left,right
paths-output = steelseries-arctis-output-chat-common
@zhanwenchen
zhanwenchen / ffmpeg_nvidia_conda_install.sh
Created October 25, 2023 23:17 — forked from kiyoon/ffmpeg_nvidia_conda_install.sh
Install nvidia accelerated ffmpeg in a conda environment.
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
vi Makefile # change the first line to PREFIX = ${CONDA_PREFIX}
make install
cd ..
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout n4.2.2
conda install nasm
@zhanwenchen
zhanwenchen / magma-readme.md
Last active August 9, 2023 20:53 — forked from Birch-san/magma-readme.md
Build magma from source

I wrote these instructions as part of "installing PyTorch with CUDA 12.1.1".

Anyway, if you still need to compile from source… here's how:

Build Magma from source

This is a dependency of PyTorch, which is sensitive to CUDA version.

Clone Magma:

@zhanwenchen
zhanwenchen / demo.py
Created July 24, 2023 01:00 — forked from apdavison/demo.py
Demonstration of parallel writing to file using h5py and mpi4py
"""
Creates an HDF5 file with a single dataset of shape (channels, n),
filled with random numbers.
Writing to the different channels (rows) is parallelized using MPI.
Usage:
mpirun -np 8 python demo.py
Small shell script to run timings with different numbers of MPI processes:
@zhanwenchen
zhanwenchen / conda_environment_rename.sh
Created May 26, 2022 15:34 — forked from Mukei/conda_environment_rename.sh
How to rename a conda environment (workaround)
#One workaround is to create clone environment, and then remove original one:
#(remember about deactivating current environment with deactivate on Windows and source deactivate on macOS/Linux)
conda create --name new_name --clone old_name --offline #use --offline flag to disable the redownload of all your packages
conda remove --name old_name --all # or its alias: `conda env remove --name old_name`
#There are several drawbacks of this method:
# time consumed on copying environment's files,
# temporary double disk usage.
@zhanwenchen
zhanwenchen / sequelize-schema-file-generator.js
Created October 19, 2017 01:08 — forked from ahelord/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
'use strict';
//////////////////////////////////
// How to use?
// 1. Create `sequelize-schema-file-generator.js` in your app root
// 2. Make sure you've ran the `sequelize init` before (It should create `config`,`seeders`,`migrations` folders).
// 3. Update `DATABASE_DSN` below to match your connection string (works with any database adapter that Sequelize supports)
// 4. Run it with `node sequelize-schema-file-generator.js`
// 5. Review the generated migrations inside of the `migrations` folder.
//////////////////////////////////
@zhanwenchen
zhanwenchen / Install NVIDIA Driver and CUDA.md
Last active March 13, 2024 23:42 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 9.0 on Ubuntu 16.04.4 LTS