Skip to content

Instantly share code, notes, and snippets.

View Brainiarc7's full-sized avatar

Dennis E. Mungai Brainiarc7

View GitHub Profile
@Brainiarc7
Brainiarc7 / nvidia-upgrade-fix
Created February 4, 2015 06:06
Fixing NVIDIA 346 upgrade on Ubuntu 14.04LTS
If you are upgrading from NVIDIA 340 to NVIDIA 346+ on Ubuntu 14.04LTS, do this to fix dkms build issues:
1. Remove the NVIDIA 340 dpkg configuration files after the upgrade:
sudo rm /var/lib/dpkg/info/nvidia-340*
2. Reconfigure the newly upgraded driver:
sudo dpkg-reconfigure nvidia-340
@Brainiarc7
Brainiarc7 / One line to rebuild all DKMS modules on Ubuntu
Last active September 20, 2023 10:09
One line to rebuild all DKMS modules on Ubuntu
Here goes.
ls /usr/src/linux-headers-* -d | sed -e 's/.*linux-headers-//' | \
sort -V | tac | sudo xargs -n1 /usr/lib/dkms/dkms_autoinstaller start
Run as root.
@Brainiarc7
Brainiarc7 / GPU toggle NVIDIA and Intel
Created February 10, 2015 09:30
Toggle the NVIDIA GPU on and off as needed in Optimus
Turn on the NVIDIA discrete GPU on an Optimus system for use when needed:
tee /proc/acpi/bbswitch <<< ON
Turn off the NVIDIA discrete GPU on an Optimus system when unloaded:
tee /proc/acpi/bbswitch <<< OFF
@Brainiarc7
Brainiarc7 / prime-select PKGBUILD for Arch Linux
Last active November 11, 2018 15:16
Enable NVIDIA PRIME's selector on Arch Linux
# Maintainer: Dennis E. Mungai <dmngaie@gmail.com>
pkgname=nvidia-prime
pkgver=0.7
pkgrel=1
pkgdesc="Tools to enable NVIDIA's Prime."
url="https://launchpad.net/ubuntu/+source/nvidia-prime"
arch=('x86_64' 'i686')
license=('GPLv3')
depends=('lightdm' 'bbswitch' 'python' 'bash')
optdepends=('nvidia' 'lightdm-gtk3-greeter')
#!/bin/bash
# Dirty script to build Unity under ArchLinux
# Thanks for PKGBUILDs, chenxiaolong!
# Valdos Sine <fat0troll at riseup dot net> 2012
# Pratik Sinha <pratik at humbug dot in> 2012
echo "Run it in directory which will be build root ;)"
echo "Make sure you're have sudo without password or you will stuck in every package installation"
echo "GO!"
sudo pacman -Sy
@Brainiarc7
Brainiarc7 / fstab-generate-arch.md
Last active March 18, 2024 13:51
Generate fstab in Arch Linux

First, install arch-install-scripts:

sudo pacman -S --needed arch-install-scripts

Secondly, mount your partitions in all the internal hard drives.

Thirdly, generate and validate your config by piping it out to stdout:

@Brainiarc7
Brainiarc7 / PKGBUILD
Last active August 29, 2015 14:15
PKGBUILD for Suricata with CUDA Toolkit v. 6.5+ support
# Maintainer: Dennis E. Mungai <dmngaie@gmail.com>
pkgname=suricata-pfring-git
_pkgname=oisf
pkgver=suricata.2.1beta3.r21.gbc2c7f4
pkgrel=1
pkgdesc="A NextGen multithreaded IDS/IPS with pf_ring, JSON Output and GeoIP support"
arch=('i686' 'x86_64')
url="http://openinfosecfoundation.org/index.php/download-suricata"
license=('GPL2')
depends=('libcap-ng' 'libnet' 'libpfring-svn' 'libyaml' 'pcre' 'jansson' 'geoip' 'libnfnetlink' 'python' 'libpcap-pfring-svn' 'libhtp-git')
#! /bin/bash
# Upgrade
sudo aptitude update
sudo aptitude full-upgrade -y
# Install CUDA
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo aptitude update
@Brainiarc7
Brainiarc7 / vgaarb.c.patch
Created March 1, 2015 23:43
Kernel patch to vgaarb.c to add 3D controller detection on Optimus notebooks
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 111d956..bd9a01f 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -507,9 +507,11 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
struct pci_bus *bus;
struct pci_dev *bridge;
u16 cmd;
+ int pci_class = pdev->class >> 8;
@Brainiarc7
Brainiarc7 / Fix-This-Shit
Created March 5, 2015 09:02
When the RSA Keys for RPM go bonkers, fix this shit.
https://techjourney.net/centos-yum-rpm-error-rpmts_hdrfromfdno-rpmdbnextiterator-header-v3-rsasha1-signature-key-id-bad/
Worked like a charm.