Skip to content

Instantly share code, notes, and snippets.

View 3XX0's full-sized avatar
🎯
Focusing

Jonathan Calmels 3XX0

🎯
Focusing
View GitHub Profile
@3XX0
3XX0 / usart.c
Last active March 20, 2018 14:24
simple AVR USART
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sfr_defs.h>
static void init(uint16_t rate)
{
UBRR0H = (uint8_t) (rate >> 8); // freq/(16*speed)-1
UBRR0L = (uint8_t) rate;
UCSR0A &= ~_BV(U2X0); // unset double speed (optiboot)
UCSR0B = _BV(RXEN0) | _BV(TXEN0); // enable transmision/reception
#! /bin/sh
# To allow users to setup their permissions:
# tee -a /etc/sudoers <<< "%lxc-users ALL=/usr/local/bin/generate-lxc-perms"
set -eu
USER="${SUDO_USER:-${1:?usage: $0 <user>}}"
UIDSPEC="$(getent passwd ${USER})"
GIDSPEC="$(getent group `id -g ${USER}`)"
#! /bin/sh
USER=$(whoami)
USER_ID=$(id -u)
GROUP_ID=$(id -g)
LXC_CONF_DIR="${HOME}/.config/lxc"
LXC_CACHE_DIR="${HOME}/.cache/lxc"
mkdir -p ${LXC_CONF_DIR} ${LXC_CACHE_DIR}