Skip to content

Instantly share code, notes, and snippets.

@majidaldo
majidaldo / nvidia_devices.sh
Last active September 21, 2022 03:38 — forked from tleyden/nvidia_devices.sh
add nvidia devices
#!/bin/bash
# Count the number of NVIDIA controllers found.
NVDEVS=`lspci | grep -i NVIDIA`
N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
N=`expr $N3D + $NVGA - 1`
PRFX='--device '
@majidaldo
majidaldo / vagrant.py
Last active October 24, 2015 13:17 — forked from lorin/vagrant.py
returns vagrant hosts for ansible inventory
#!/usr/bin/env python
# Adapted from Mark Mandel's implementation
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/vagrant.py
import argparse
import json
import paramiko
import subprocess
import sys