Skip to content

Instantly share code, notes, and snippets.

View Amey-D's full-sized avatar

Amey Deshpande Amey-D

View GitHub Profile
@Amey-D
Amey-D / Console Log
Last active October 4, 2018 05:12
Debug memory usage in Stackdriver Exporter for Flask application
### In terminal 1 ###
$ python
Python 3.6.5 (default, Mar 30 2018, 06:41:53)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from memory_profiler import memory_usage
>>> while True: print(memory_usage(32265, 1, 1))
...
[42.6484375]
[42.8046875]
@Amey-D
Amey-D / unlock-loadpin.sh
Created May 18, 2017 06:29
Script to disable the loadpin feature on a Container-Optimized OS instance.
#!/bin/bash
set -o pipefail
set -o errexit
unlock_loadpin_and_reboot_if_needed() {
kernel_cmdline="$(cat /proc/cmdline)"
# Assume that kernel commandline will never contain "lsm.module_locking=1",
# which is the default value when unspecified.
if echo "${kernel_cmdline}" | grep -q -v "lsm.module_locking=0"; then
@Amey-D
Amey-D / nvidia.cfg
Created May 18, 2017 06:29
Cloud-config script to install Nvidia GPU driver in a container on a GCE instance running Container-Optimized OS from Google.
#cloud-config
write_files:
- path: /etc/systemd/system/unlock-loadpin.service
permissions: 0755
owner: root
content: |
[Unit]
Description=Disable loadpin feature
Requires=network-online.target
@Amey-D
Amey-D / nvidia-installer.sh
Last active July 28, 2024 18:22
Script to install Nvidia GPU driver inside an Ubuntu container running on COS instance. See the cloud-config script for usage details.
#!/bin/bash
set -o errexit
set -o pipefail
# The script must be run as a root.
NVIDIA_DRIVER_VERSION="${NVIDIA_DRIVER_VERSION:-375.26}"
NVIDIA_DRIVER_DIR="/nvidia-src"
@Amey-D
Amey-D / create_instance.sh
Last active March 27, 2020 21:51
Script to create a GPU-enabled COS instance on GCE and to install Nvidia GPU driver in a container.
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
set -x
INSTANCE_NAME=$1
shift