Skip to content

Instantly share code, notes, and snippets.

@piec
piec / my_prompt.sh
Last active August 29, 2015 13:55 — forked from madx/my_prompt.sh
#!/bin/bash
function __hbar
{
eval printf '%.0s$2' {1..$1}
}
function __barre
{
__hbar $(tput cols) ─
@piec
piec / vidtest.c
Created February 3, 2014 19:55 — forked from Circuitsoft/Output
#include <errno.h>
#include <fcntl.h>
#include <linux/videodev2.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
@piec
piec / jobcontrol.vim
Last active August 29, 2015 14:05 — forked from tarruda/jobcontrol.vim
" Demo of Neovim job control feature.
"
" It starts two netcat processes listening on the same TCP port,
" the second process will exit immediately since the port will be
" unavailable(Used to demonstrate the stderr/exit events)
" To play with this, use two terminals
"
" On terminal 1: `nvim -S jobcontrol.vim`.
" Use `:call jobwrite(srv1_id, "string") to write
" data to the netcat client

I want to write Rust code on my computer (x86_64, Ubuntu 14.04) and produce arm executables. I found hints on the internet, but not a concise set of instructions on what to do. So I wrote them down exactly:

apt-get install g++-arm-linux-gnueabihf
git clone https://github.com/mozilla/rust.git
mkdir rust/build-cross
cd rust/build-cross
../configure --target=arm-unknown-linux-gnueabihf --prefix=$HOME/local/rust-cross
make -j8 && make install
@piec
piec / cargo build --verbose --target=arm-unknown-linux-gnueabi
Last active September 20, 2017 20:29
cargo build --verbose --target=arm-unknown-linux-gnueabi
~/work/dev/rust-arm/prefix3/bin/hallo % cargo build --verbose --target=arm-unknown-linux-gnueabi
Compiling hallo v0.0.1 (file:///home/pierre/work/dev/rust-arm/prefix3/bin/hallo)
Running `rustc src/main.rs --crate-name hallo --crate-type bin -g --out-dir /home/pierre/work/dev/rust-arm/prefix3/bin/hallo/target/arm-unknown-linux-gnueabi --emit=dep-info,link --target arm-unknown-linux-gnueabi -L dependency=/home/pierre/work/dev/rust-arm/prefix3/bin/hallo/target/arm-unknown-linux-gnueabi -L dependency=/home/pierre/work/dev/rust-arm/prefix3/bin/hallo/target/arm-unknown-linux-gnueabi/deps`
error: linking with `cc` failed: exit code: 1
note: cc '-Wl,--as-needed' '-L' '/home/pierre/work/dev/rust-arm/prefix3/lib/rustlib/arm-unknown-linux-gnueabi/lib' '-o' '/home/pierre/work/dev/rust-arm/prefix3/bin/hallo/target/arm-unknown-linux-gnueabi/hallo' '/home/pierre/work/dev/rust-arm/prefix3/bin/hallo/target/arm-unknown-linux-gnueabi/hallo.o' '-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive' '-Wl,--gc-section
~/work/dev/cargo-git/cargo-cross % which arm-unknown-linux-gnueabi-gcc
/home/pierre/work/dev/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux/bin/arm-unknown-linux-gnueabi-gcc
~/work/dev/cargo-git/cargo-cross % which rustc
/home/pierre/work/dev/rust-arm/prefix3/bin/rustc
~/work/dev/cargo-git/cargo-cross % echo $LD_LIBRARY_PATH
/home/pierre/work/dev/rust-arm/prefix3/lib:
~/work/dev/cargo-git/cargo-cross % rustc --version
@piec
piec / gpg2qrcodes.sh
Last active August 27, 2015 08:41 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
# Heavily depends on:
# libqrencode (fukuchi.org/works/qrencode/)
# paperkey (jabberwocky.com/software/paperkey/)
# zbar (zbar.sourceforge.net)
# Producing the QR codes:
# Split over 4 codes to ensure the data per image is not too large.
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
split temp -n 4 IMG
for f in IMG*; do cat $f | qrencode -o $f.png; done
@piec
piec / gitlab.log
Created September 8, 2015 10:16
gitlab failing to start
[2015-09-08T09:52:46+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /opt/gitlab/embedded
One version per cookbook
[2015-09-08T09:52:46+00:00] INFO: Forking chef instance to converge...
[2015-09-08T09:52:46+00:00] INFO: *** Chef 12.4.0.rc.2 ***
[2015-09-08T09:52:46+00:00] INFO: Chef-client pid: 19
[2015-09-08T09:52:47+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/a5948ad0938d
[2015-09-08T09:52:47+00:00] INFO: Setting the run_list to ["recipe[gitlab]"] from CLI options
[2015-09-08T09:52:47+00:00] INFO: Run List is [recipe[gitlab]]
[2015-09-08T09:52:47+00:00] INFO: Run List expands to [gitlab]
// X XX X X
// X X
// XX X X XXXX XXX XXX X XX XXX XXXX XXX X XXX
// X X X X X X X X X X XX X X X X X X
// X X X X X X XXXXX X X XXXX X X X XXXX
// X X X X X X X X X X X X X X X X
// X X X X X XXXX XXX X XXXX X X X XXXX
package minecraftia
A [ XXX ]
A [X X]
A [X X]
A [XXXXX]
A [X X]
A [X X]
A [X X]
A [ ]
B [XXXX ]
B [X X]