Skip to content

Instantly share code, notes, and snippets.

View sar's full-sized avatar

Sar Malik sar

View GitHub Profile
@sar
sar / osx-fuse-ntfs-3g-mount-volume.sh
Last active April 14, 2019 23:40
Bash script to mount a drive with R/W permissions using OSX FUSE NTFS-3G layer.
#!/bin/bash
printf " ==================================== \n NTFS-3G Mounter | Author: Sarthak Malik \n Content made available as Open Source under MIT-License \n Remount a drive with R/W permissions using OSX-FUSE NTFS-3G layer. \n For usage guide: https://github.com/osxfuse/osxfuse/wiki/NTFS-3G \n ==================================== \n"
printf " ==================================== \n WARNING! READ CAREFULY: \n The specified volume will be unmounted. \n Please quit and save any applications before proceeding. Use at your own risk, no warranties or gaurantees implied of any kind. \n ==================================== \n"
printf " Script Usage: \n $ chmod +x ./script_name.sh \n $ ./script_name.sh \n ==================================== \n\n"
if [[ "$OSTYPE" == "darwin"* ]]
then
@sar
sar / 10-nvidia.conf
Created November 18, 2019 04:58
/etc/X11/xorg.conf.d/10-nvidia.conf
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
Option "SLI" "Auto"
Option "BaseMosaic" "on"
EndSection
@sar
sar / nvidia.conf
Created November 18, 2019 04:59
/usr/lib/modprobe.d/nvidia.conf
blacklist nouveau
# Make a soft dependency for nvidia-uvm as adding the module loading to
# /usr/lib/modules-load.d/nvidia-uvm.conf for systemd consumption, makes the
# configuration file to be added to the initrd but not the module, throwing an
# error on plymouth about not being able to find the module.
# Ref: /usr/lib/dracut/modules.d/00systemd/module-setup.sh
# Even adding the module is not the correct thing, as we don't want it to be
# included in the initrd, so use this configuration file to specify the
@sar
sar / grub
Created November 18, 2019 05:02
/etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 zswap.enabled=1"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
@sar
sar / .Xdefaults
Last active September 25, 2021 21:08
Xcursor theme overrides for Standard DPI screen usage, place in `~/.Xdefaults`
Xcursor.size: 24
Xcursor.theme: DMZ-Black
@sar
sar / kvm_passthrough_guide.md
Last active May 23, 2021 20:14
Common settings for USB and PCI-E device passthrough using libvirt qemu kvm

Common settings for USB and PCI-E device passthrough using libvirt qemu kvm

Editing QEMU KVM domain

Insert desired props in XML format using $ sudo virsh edit <domain>

Passthrough USB Device

To query usb devices reported on host system, run lsusb -v | grep ${target_name}

@sar
sar / resize-kvm-lvm-vg-lvm.md
Created August 19, 2020 03:01
Resize Qemu KVM with contained root LVM

Resize qcow2 image attached to KVM and internal LVM root vg, lv

Obtain root access with sudo -i before running the following commands.

Resize KVM qcow2 image

Online resize is not supported, it is recommended to clone the image before proceeding. To allocate additional blocks to an image that does not pre-allocate space, run the following command.

$ qemu-img resize &lt;&gt; +128G
@sar
sar / displaycal_fedora32.sh
Created August 27, 2020 15:15
DisplayCAL GUI on Fedora 32 via Toolbox Container
#!/bin/bash
tb_exists=`which toolbox`
if [ ${tb_exists} != "/usr/bin/toolbox" ]
then
sudo dnf install toolbox -y
fi
toolbox create -c displaycal -r 31 -y
@sar
sar / trainLMS_pub.py
Created October 26, 2020 16:01 — forked from kinoc/trainLMS_pub.py
Fine-tune GPT-2 1558M on a Titan RTX using IBM Tensorflow Large Model Support v2
#!/usr/bin/env python3
# Usage:
# PYTHONPATH=src ./train --dataset <file|directory|glob>
# Got 1558M to train on a TITAN RTX using IBM Tensorflow_Large_Model_Support
# TLMS can insert explicit swaps in the graph between GPU and CPU, to extend the memory
# But the graph has While_Loop, so you have to use the TFLMSv2 version (which works with TF 1.x)
#
# Download, expand, get the egg out and install.
@sar
sar / toolbox_figma_linux.sh
Created December 3, 2020 18:15
Run figma-linux in a sandbox container on Fedora
#!/bin/bash
tb_exists=`which toolbox`
if [ ${tb_exists} != "/usr/bin/toolbox" ]
then
sudo dnf install toolbox -y
fi
toolbox create -c figma -r 31 -y