Skip to content

Instantly share code, notes, and snippets.

Avatar

Pi-Yueh Chuang piyueh

View GitHub Profile
@piyueh
piyueh / list_files_in_docker_layers.py
Created May 31, 2022
List files in each layer of an image tarball created through `docker save`.
View list_files_in_docker_layers.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2022 Pi-Yueh Chuang <pychuang@pm.me>
#
# Distributed under terms of the BSD 3-Clause license.
"""List files in each layer of an image tarball created through `docker save`.
"""
@piyueh
piyueh / openfoam_reader.py
Created Apr 8, 2022
A simple OpenFOAM data reader with double-precision floats
View openfoam_reader.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2022 Pi-Yueh Chuang <pychuang@pm.me>
#
# Distributed under terms of the BSD 3-Clause license.
"""Test.
"""
@piyueh
piyueh / kitty-gruvbox-256color-dark.conf
Last active Mar 10, 2021
Gruvbox 256-color palette for Kitty (dark; hard contrast)
View kitty-gruvbox-256color-dark.conf
# reference: https://github.com/morhetz/gruvbox
background #1d2021
foreground #ebdbb2
selection_background #ebdbb2
selection_foreground #928374
cursor #ebdbb2
cursor_text_color #1d2021
url_color #fe8019
@piyueh
piyueh / GCP_Slurm_Terraform.md
Last active Jan 28, 2022
Scripts to create a Slurm cluster on GCP with Terraform
View GCP_Slurm_Terraform.md

README

Steps

  1. Install Google Cloud SDK: to manipulate cloud resources

  2. Install Terraform: to create/destroy clusters from pre-defined specs

@piyueh
piyueh / offlineimap_funcs.py
Last active Feb 26, 2021
Functions to get Google credentials & tokens for offlineimap
View offlineimap_funcs.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 Pi-Yueh Chuang <pychuang@pm.me>
#
# Distributed under terms of the BSD 3-Clause license.
"""Functions used by an offlineimap instance.
@piyueh
piyueh / requires_partof_bindsto_diff.py
Created Feb 24, 2021
A script to test the difference between Requires, PartOf, and BindsTo of a systemd.unit
View requires_partof_bindsto_diff.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 Pi-Yueh Chuang <pychuang@pm.me>
#
# Distributed under terms of the BSD 3-Clause license.
"""Test the difference between Requires=, PartOf=, and BindsTo= of a systemd.unit.
"""
@piyueh
piyueh / torch_sum_prof.py
Created Jan 29, 2020
Profile torch.sum (torch.Tensor.sum) with different shape arrangements
View torch_sum_prof.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""
Profile torch.sum (torch.Tensor.sum) with different shape arrangements.
@piyueh
piyueh / tf_keras_tfp_lbfgs.py
Last active Aug 21, 2022
Optimize TensorFlow & Keras models with L-BFGS from TensorFlow Probability
View tf_keras_tfp_lbfgs.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""An example of using tfp.optimizer.lbfgs_minimize to optimize a TensorFlow model.