Skip to content

Instantly share code, notes, and snippets.

View piyueh's full-sized avatar

Pi-Yueh Chuang piyueh

View GitHub Profile
@piyueh
piyueh / list_files_in_docker_layers.py
Created May 31, 2022 20:34
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 April 8, 2022 18:07
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 March 10, 2021 18:13
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 December 6, 2022 03:03
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 February 26, 2021 23:30
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 February 24, 2021 08:48
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 January 29, 2020 01:46
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 November 6, 2023 20:15
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.