Skip to content

Instantly share code, notes, and snippets.

View piyueh's full-sized avatar

Pi-Yueh Chuang piyueh

View GitHub Profile
@piyueh
piyueh / tf_keras_tfp_lbfgs.py
Last active March 31, 2024 02:36
Optimize TensorFlow & Keras models with L-BFGS from TensorFlow Probability
#! /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.
@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`.
#! /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 / 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
#! /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 / GCP_Slurm_Terraform.md
Last active December 6, 2022 03:03
Scripts to create a Slurm cluster on GCP with Terraform

README

Steps

  1. Install Google Cloud SDK: to manipulate cloud resources

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

@piyueh
piyueh / openfoam_reader.py
Created April 8, 2022 18:07
A simple OpenFOAM data reader with double-precision floats
#! /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)
# 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 / offlineimap_funcs.py
Last active February 26, 2021 23:30
Functions to get Google credentials & tokens for offlineimap
#! /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 / torch_sum_prof.py
Created January 29, 2020 01:46
Profile torch.sum (torch.Tensor.sum) with different shape arrangements
#! /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.