For POSIX (ie. not just Linux):
#!/bin/sh.
For GNU bash:
# Source: https://stackoverflow.com/a/4791612 | |
import os | |
import signal | |
import subprocess | |
# The os.setsid() is passed in the argument preexec_fn so | |
# it's run after the fork() and before exec() to run the shell. | |
pro = subprocess.Popen(cmd, stdout=subprocess.PIPE, | |
shell=True, preexec_fn=os.setsid) |
# Error: | |
# Loading configuration... | |
# Initializing packages... | |
# Preparing boards... | |
# Verifying... | |
# Sketch uses 4044 bytes (12%) of program storage space. Maximum is 32256 bytes. | |
# Global variables use 407 bytes (19%) of dynamic memory, leaving 1641 bytes for local variables. Maximum is 2048 bytes. | |
# Uploading... | |
# An error occurred while uploading the sketch | |
# avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied |
#!/usr/bin/env bash | |
# Colours for terminal colours | |
RED=`tput setaf 1` | |
GREEN=`tput setaf 2` | |
YELLOW=`tput setaf 3` | |
PINK=`tput setaf 5` | |
CYAN=`tput setaf 6` | |
RESET=`tput sgr0` |
# Add latest repo to ubuntu | |
/usr/lib/apt/apt-helper download-file http://debian.sur5r.net/i3/pool/main/s/sur5r-keyring/sur5r-keyring_2019.02.01_all.deb keyring.deb SHA256:176af52de1a976f103f9809920d80d02411ac5e763f695327de9fa6aff23f416 | |
dpkg -i ./keyring.deb | |
echo "deb http://debian.sur5r.net/i3/ $(grep '^DISTRIB_CODENAME=' /etc/lsb-release | cut -f2 -d=) universe" >> /etc/apt/sources.list.d/sur5r-i3.list | |
apt update | |
apt install i3 | |
# Copy config to home directory. Modify ctrl+grave | |
mkdir ~/.config/dunst | |
cp /etc/xdg/dunst/dunstrc ~/.config/dunst/dunstrc |
#include <EEPROM.h> | |
void EEPROMWrite32bit(uint8_t address, uint32_t value) | |
{ | |
uint8_t bytes[4]; | |
bytes[0] = (value >> 24) & 0xFF; | |
bytes[1] = (value >> 16) & 0xFF; | |
bytes[2] = (value >> 8) & 0xFF; | |
bytes[3] = value & 0xFF; |
# Gradle files | |
.gradle/ | |
build/ | |
# Local configuration file (sdk path, etc) | |
local.properties | |
# IntelliJ | |
*.iml | |
.idea/workspace.xml |
# Check current driver | |
sudo lshw -C display | |
# Check available drivers. Example output: | |
# == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == | |
# modalias : pci:v000010DEd000013B0sv00001462sd0000116Bbc03sc02i00 | |
# vendor : NVIDIA Corporation | |
# model : GM107GLM [Quadro M2000M] | |
# driver : nvidia-384 - distro non-free recommended | |
# driver : xserver-xorg-video-nouveau - distro free builtin |
// Set certain bits without affecting the rest. | |
// Clear all bits to a known value, then set them. | |
// newvalue must contain all bits | |
value = (value & ~mask) | (newvalue & mask); |