Skip to content

Instantly share code, notes, and snippets.

View coenraadhuman's full-sized avatar
🐧

Coenraad Human coenraadhuman

🐧
View GitHub Profile
@coenraadhuman
coenraadhuman / MAC_changer.sh
Created April 29, 2017 10:18
MAC Spoofing script for Ubuntu 16.04
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
exec sudo "$0" "$@"
fi
change_mac() {
echo -n "Choose network interface. (enp4s0f2): "
read nic
ifconfig $nic down
@coenraadhuman
coenraadhuman / fans_start.sh
Created December 31, 2017 07:17
This is a simple script for changing fan speed on iMac running Linux (ensure applesmc is active)
#!/bin/bash
# Root?
if [ "$(id -u)" != "0" ]; then
exec sudo "$0" "$@"
fi
fan_speeds()
{
echo "Available fan speeds on this iMac:"
@coenraadhuman
coenraadhuman / ubuntu1804.sh
Last active April 30, 2018 09:02
Things to do after Ubuntu 18.04 install
#!/bin/bash
#Disable touchpad when external mouse is plugged in
gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled-on-external-mouse
#Install TLP for better control over temperature and CPU frequency on Intel P-State
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get install tlp tlp-rdw
sudo nano /etc/default/tlp
sudo tlp-stat -s
@coenraadhuman
coenraadhuman / RaceConditions.cpp
Created March 11, 2019 02:55
C++ program that simulates a race condition on a shared resource (print to stdout).
#include <iostream>
#include <thread>
#include <mutex>
using namespace std;
// mutex used to lock other threads from gaining access to shared resource
mutex m_mutex;
// shared print function for cout
void shared_print(char c, int v) {
#include <iostream>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
using namespace std;
int main()
{
// ftok to generate unique key
key_t key = ftok("shmfile",65);
@coenraadhuman
coenraadhuman / chromium-snap-arch.sh
Last active August 15, 2019 07:12
Install, Open Chromium in Manjaro Live USB
#!/bin/bash
sudo pacman -S snapd --noconfirm
sudo systemctl restart snapd.service
sudo snap install chromium
/snap/bin/chromium
@coenraadhuman
coenraadhuman / main.js
Last active August 22, 2019 13:46
Using Angular and Firebase Project with Electron App Workaround
require('./server');
const { app, BrowserWindow } = require('electron')
let win;
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 1200,
height: 720,
@coenraadhuman
coenraadhuman / nvidia-optimus-screen-tearing-fix-arch.sh
Created September 5, 2019 13:59
Nvidia optimus screen tearing fix for Arch.
sudo touch /etc/modprobe.d/zz-nvidia-modeset.conf
sudo echo "options nvidia_drm modeset=1" > /etc/modprobe.d/zz-nvidia-modeset.conf
echo "Where XY is the name of the kernel, for example linux419."
echo "..."
echo "Run the following command:"
echo "mkinitcpio -p linuxXY"
@coenraadhuman
coenraadhuman / mirror.md
Created September 10, 2019 04:17
Update Arch Mirrors

Automated

Mirrors will be sorted by their current response times and then te mirror list will be exported and saved to the following directory:

/etc/pacman.d/mirrorlist
  • Fetch and add each and every mirror to the list:
@coenraadhuman
coenraadhuman / inotify.md
Last active April 23, 2024 09:09
Increasing the amount of inotify watchers

Increasing the amount of inotify watchers

Take note this is my personal edited version and the command related to Arch has been changed to work on my Arch system.

Increase inotify watchers