Skip to content

Instantly share code, notes, and snippets.

View xueliu's full-sized avatar
🏠
Working from home

Xue Liu xueliu

🏠
Working from home
View GitHub Profile
#include <stdio.h>
#include <memory>
#include <string.h>
#include <vector>
using namespace std;
struct Data
{
char data[1000];
########################################################################
########################################################################
## This is a sample configuration file for the ftpsync mirror script. ##
## Only options most users may need are included. For documentation ##
## and all available options see ftpsync.conf(5). ##
########################################################################
########################################################################
# MIRRORNAME=`hostname -f`
TO="/home/debian-mirror/data"
@xueliu
xueliu / start_qemu.bat
Created October 14, 2021 14:22
windows qemu start debian
"c:\Program Files\qemu\qemu-system-arm" ^
-M vexpress-a9 ^
-smp 4 ^
-m 256 ^
-kernel zImage ^
-dtb vexpress-v2p-ca9.dtb ^
-drive file=eco335.v4.rootfs.ext4,if=sd,format=raw ^
-append "console=ttyAMA0,115200 rootwait root=/dev/mmcblk0" ^
-nic user,hostfwd=tcp::5022-:22 ^
-nic tap,ifname=LAN-Verbindung ^
@xueliu
xueliu / qemu-ifdown
Created October 13, 2021 10:26
BuildRoot vexpress-a9 boot from NFS ifdown
#!/bin/sh
set -x
if [ -n "$1" ];then
ip link set ${1} down
ip link set ${SWITCH} down
ip link delete dev ${SWITCH}
ip link delete dev ${1}
ip address add ${HOST_IP} dev ${ETHERNET_PORT}
@xueliu
xueliu / qemu-ifup
Created October 13, 2021 10:25
BuildRoot vexpress-a9 boot from NFS ifup
#!/bin/sh
set -x
if [ -n "$1" ];then
ip link add ${SWITCH} type bridge
sleep 1s
ip tuntap add $1 mode tap user `whoami`
sleep 0.5s
ip link set dev ${SWITCH} up
@xueliu
xueliu / start-vexpress.qemu.nfs.sh
Last active October 13, 2021 10:27
BuildRoot vexpress-a9 boot from NFS
#!/bin/bash
set -x
if [ $EUID -ne 0 ]; then
echo "Error: This script ( ${0} ) must be run with root privileges"
exit 1
fi
PATH=$PATH:/sbin:/usr/sbin
@xueliu
xueliu / version-up.sh
Created February 11, 2021 22:56 — forked from OleksandrKucherenko/version-up.sh
Calculate Next Suitable Version Tag for Your Git based project
#!/usr/bin/env bash
## Copyright (C) 2017, Oleksandr Kucherenko
## Last revisit: 2017-09-29
# For help:
# ./versionip.sh --help
# For developer / references:
# https://ryanstutorials.net/bash-scripting-tutorial/bash-functions.php
# http://tldp.org/LDP/abs/html/comparison-ops.html
@xueliu
xueliu / tuple.h
Created December 6, 2020 13:03
[c++ tuple] a simple tuple implementation #C++
template<typename ... Values> class tuple;
template<> class tuple<> {};
template<typename Head, typename ... Tail>
class tuple<Head, Tail...> : private tuple<Tail...>
{
private:
typedef tuple<Tail...> inherited;
public:
tuple() {}
//
// Created by lx on 27.07.20.
//
#ifndef LEDDRIVER_DEVICE_H
#define LEDDRIVER_DEVICE_H
#include <iostream>
using namespace std;
@xueliu
xueliu / stm32f746_uboot_flash.sh
Last active September 26, 2020 22:04
stm32f746 uboot openocd
#!/bin/bash
openocd -f interface/stlink-v2-1.cfg -f board/stm32f7discovery.cfg \
-c "init" \
-c "reset init" \
-c "flash probe 0" \
-c "flash info 0" \
-c "flash write_image erase $UBOOT_PATH/spl/u-boot-spl.bin 0x08000000" \
-c "flash write_image erase $UBOOT_PATH/u-boot.bin 0x08008000" \
-c "reset run" \