Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# scripts to install ArchLinuxARM for RPi
# Author: Yangxuan <yangxuan8282@gmail.com>
#
# run this scripts with root user, not via sudo
# to create the partitions programatically (rather than manually)
# we're going to simulate the manual input to fdisk
# Note that a blank line (commented as "defualt" will send a empty
# line terminated with a newline to take the fdisk default.
if [ "$EUID" -ne 0 ]
@yangxuan8282
yangxuan8282 / muttrc
Created December 9, 2016 08:56
Hotmail template config for mutt, just insert your mail account and password to "imap_user" and "imap_pass", if 2-factor is enable, generate an app password.
set ssl_starttls=yes
set ssl_force_tls=yes
set imap_user = 'user_name@hotmail.com'
set imap_pass = 'password_here'
set from= $imap_user
set use_from=yes
set realname='Your_Name'
set folder = imaps://imap-mail.outlook.com:993
set spoolfile = "+INBOX"
@yangxuan8282
yangxuan8282 / qt-5.7.0-qtbase_rpi-2.patch
Created December 10, 2016 08:32
The bug is that QT assumes the ARM chip on the Pi has a CRC32 hardware feature, when it does not.
--- qt-everywhere-opensource-src-5.7.0/qtbase/src/corelib/tools/qhash.cpp.orig 2016-12-06 08:34:11.021300221 +0000
+++ qt-everywhere-opensource-src-5.7.0/qtbase/src/corelib/tools/qhash.cpp 2016-12-06 08:35:07.411028643 +0000
@@ -137,7 +137,7 @@
h = _mm_crc32_u8(h, *p);
return h;
}
-#elif defined(__ARM_FEATURE_CRC32)
+#elif defined(__ARM_FEATURE_CRC32_NA)
static inline bool hasFastCrc32()
{
@yangxuan8282
yangxuan8282 / rpi-mirrors.sh
Last active January 17, 2017 06:11
change to China mirrors, run with: curl -sSL https://git.io/vMKbc | sh
#!/bin/bash
sudo mv /etc/apt/sources.list /etc/apt/sources.list.orig
sudo sh -c 'cat > /etc/apt/sources.list << "EOF"
deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ jessie main contrib non-free rpi
#deb-src http://mirrors.neusoft.edu.cn/raspbian/raspbian/ jessie main contrib non-free rpi
EOF'
sudo mv /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.orig
sudo sh -c 'cat > /etc/apt/sources.list.d/raspi.list << "EOF"
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ jessie main ui
#deb-src http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ jessie main ui
@yangxuan8282
yangxuan8282 / migrate_noobs.sh
Last active March 14, 2017 16:39
bash scripts migrating NOOBs to Raspbian, run it with `curl -SL https://git.io/vy1Ln | bash`
#!/bin/bash
# FROM https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=106529
# RUN `bash migrate_noobs.sh`
# ABOUT migrating NOOBs to Raspbian
# you need prepare 2 SD cards, card A running NOOBs that you want to migrate, put this card in pi card slot
# card B plug into card reader, insert this into pi usb port, all data in this card will be erased
# and remove all other storage
BOOT_PARTITION=`mount|grep ' /boot '|cut -d' ' -f 1`
@yangxuan8282
yangxuan8282 / README.md
Last active July 3, 2022 00:54
the systemd of ssh tunnel for https

PortForwarding with ssh tunnel

you need install autossh first

you can edit bash scripts then run it, or paste systemd templates to your /etc/systemd/system path, and check bash scripts to finish rest step

@yangxuan8282
yangxuan8282 / dtunnel_systemd.sh
Last active May 24, 2017 15:02
temporary fix [dog tunnel lite]( https://github.com/vzex/dog-tunnel/tree/udpVersion ) reconnect port in used issues, from this post: https://www.v2ex.com/t/362833
#!/bin/bash
# temporary fix [dog tunnel lite]( https://github.com/vzex/dog-tunnel/tree/udpVersion ) reconnect port in used issues
# before run this script you need to install `sudo`, `dog-tunnel lite` on server, and install `screen`, `sudo`, `dog-tunnel lite` on client
#
# you can download `dog-tunnel lite` binary file here ( the offcial prebuilt arm binary file not work for me ):
# [amd64]: wget https://raw.githubusercontent.com/yangxuan8282/docker-image/master/dog-tunnel/lite_v1.30/amd64/dog-tunnel
# [arm]: wget https://raw.githubusercontent.com/yangxuan8282/docker-image/master/dog-tunnel/lite_v1.30/arm/dog-tunnel
# the binary file was built in docker ( https://github.com/yangxuan8282/docker-image/blob/master/dog-tunnel )
# the default installation path of `dog-tunnel lite` is `/usr/local/bin/`
#
@yangxuan8282
yangxuan8282 / emoji-info.sh
Last active October 14, 2023 07:26
Emoji❤bash
#!/bin/bash
# run this scripts with `bash emoji-info.sh` or `./emoji-info.sh`
usage() {
cat << EOF
usage: $0 [options] <emoji>
Options:
-h Show this message
-o Octal Escape Sequence
@yangxuan8282
yangxuan8282 / tmp.md
Last active June 27, 2017 16:09
tmp use

traefik/docker-compose.yml

version: '2'

services:
  proxy:
    image: traefik
    networks:
      - webgateway
@yangxuan8282
yangxuan8282 / compile-mpv-mmal-rpi.md
Last active June 3, 2020 14:23
compile mpv with hardware acceleration (mmal) on RPi, no windows borders

mpv

The latest working mpv version for this guides is 0.27.2, tested on 2018-03-13-raspbian-stretch.

sudo apt-get update && sudo apt-get upgrade -y && 
sudo apt-get install -y git devscripts equivs &&
sudo apt-get install -y libgles2-mesa-dev