Skip to content

Instantly share code, notes, and snippets.

View larsch's full-sized avatar

Lars Christensen larsch

View GitHub Profile
#!/usr/bin/env ruby
#
# Convert .PNG to rasterized SVG for laster etching. Save PNG at 50.8
# DPI (2 lines per mm) or adjust 'dots_per_mm' below for different
# DPI. Horizontal resolution is also locked to this DPI in this
# version.
require 'chunky_png'
require 'nokogiri'
set -exu
umount /mnt/boot || true
umount /mnt || true
parted -s /dev/sda mklabel gpt
parted -s /dev/sda mkpart ext2 1 3
parted -s /dev/sda -- mkpart ext4 3 -1
parted -s /dev/sda set 1 bios_grub
mkfs.ext4 /dev/sda2
mount /dev/sda2 /mnt
pacstrap /mnt base grub
@larsch
larsch / esp-open-sdk-environment.sh
Created May 3, 2015 09:40
Environment variables for building for ESP8266 using esp-open-sdk
export SDK_BASE=$HOME/esp-open-sdk/esp_iot_sdk_v1.0.1
export XTENSA_TOOLS_ROOT=$HOME/esp-open-sdk/xtensa-lx106-elf/bin
export ESPTOOL=$HOME/esp-open-sdk/esptool/esptool.py
export PATH=$HOME/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
@larsch
larsch / bootstrap-esp-open-sdk-arch.sh
Last active January 6, 2017 16:57
Bootstrap script for ESP8266 SDK on Arch Linux
#!/bin/sh -exu
sudo pacman -S --needed --noconfirm base-devel python2 expat ncurses gperf git wget unzip
sudo ln -sf /usr/bin/python2 /usr/bin/python
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make STANDALONE=y
@larsch
larsch / list-installed-arch.sh
Last active December 26, 2016 14:46
List packaged installed in Arch Linux (except base/base-devel)
comm -23 <(pacman -Qq|sort) <(pacman -Qqg base base-devel|xargs -n1 pactree -ul|sort -u)
#!/bin/sh -ex
sudo pacman --needed --noconfirm -S base-devel
curl -LO https://github.com/larsch/libbcm2835-aur/archive/v1.42-1.tar.gz
tar xfz v1.42-1.tar.gz
cd libbcm2835-aur-1.42-1
makepkg -sf
sudo pacman --noconfirm -U libbcm2835*.pkg.tar.xz
curl -LO https://aur.archlinux.org/packages/ra/raspi-off-button/raspi-off-button.tar.gz
#!/bin/sh -ex
sudo pacman -Sy base-devel --needed --noconfirm
curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
tar xfz package-query.tar.gz -C /tmp
pushd /tmp/package-query
makepkg --noconfirm -sf
sudo pacman -U --noconfirm package-query-*.pkg.tar.xz
popd
curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
tar xfz yaourt.tar.gz -C /tmp

Update package index and upgrade all installed packaged

pacman -Syu

(S = sync, y = update, u = upgrade installed)

Install packages from AUR:

  1. Partion the disk
parted /dev/sda
mklabel gpt
mkpart ext2 1 3
set 1 bios_grub on
mkpart ext2 3 131
mkpart ext4 131 -1
  1. Create the file systems
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
void* thread_routine(void* param) {
printf("I'm running\n");
}
#define CP(x) \
{ int r = (x); \