Skip to content

Instantly share code, notes, and snippets.

@tirzasrwn
tirzasrwn / linaro-toolchain.md
Created July 1, 2022 04:42
Linaro Toolchain

About

Linaro is an engineering organization that works on free and open-source software such as the Linux kernel, the GNU Compiler Collection (GCC), power management, graphics and multimedia interfaces for the ARM family of instruction sets and implementations thereof as well as for the Heterogeneous System Architecture (HSA). The company provides a collaborative engineering forum for companies to share engineering resources and funding to solve common problems on ARM software.

GNU Toolchain

Projects included in the GNU toolchain are:

  • GNU make: an automation tool for compilation and build
  • GNU Compiler Collection (GCC): a suite of compilers for several programming languages
  • GNU C Library (glibc): core C library including headers, libraries, and dynamic loader
  • GNU Binutils: a suite of tools including linker, assembler and other tools
@tirzasrwn
tirzasrwn / analyze-ram-and-cpu-usage.md
Created June 13, 2022 03:35
Analyze ram and cpu usage by an application or two

Get data in real time using top

top -b -d 0.1 | grep "app-1\|app-2"

You will get data with somethin like this:

 1442 pi        20   0  141152  71724  19588 S  68.3   7.6   0:00.71 prompter_sample
 1442 pi        20   0  142176  72588  19964 S  53.4   7.7   0:01.26 prompter_sample
 1442 pi        20   0  142176  72588  19964 S   3.9   7.7   0:01.30 prompter_sample
 1442 pi        20   0  142176  72588  19964 S  10.6   7.7   0:01.41 prompter_sample
@tirzasrwn
tirzasrwn / automate-ssh-login-password.md
Last active May 27, 2022 04:35
Automate SSH login password

Client-side

ssh-keygen -t rsa -b 2048 # Enter twice
# Will create file ~/.ssh/id_rsa  ~/.ssh/id_rsa.pub
ssh-copy-id <server-user>@<server-ip> # This will ask you ssh-sever-password

# Test your work. It's should automate without password.
ssh <server-user>@<server-ip>

Server-side

@tirzasrwn
tirzasrwn / CMakeLists.txt
Last active May 25, 2022 04:52
mqtt-example-c
cmake_minimum_required(VERSION 3.10)
project(run C)
add_executable(run mqtt_example.c)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
target_link_libraries(run
mosquitto
)
@tirzasrwn
tirzasrwn / main.c
Last active April 4, 2022 09:20
Encrypt decrypt file using openssl library
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <openssl/evp.h>
#include <openssl/aes.h>
const unsigned char g_cKey[] = "thiskeyisverybad";
const unsigned char g_iVec[] = "dontusethisinput";
void encrypt(FILE *ifp, FILE *ofp)
@tirzasrwn
tirzasrwn / busybox_for_uClibc-0.9.33.2.md
Last active March 21, 2022 09:45
Build busybox that use uClibc-0.9.33.2

http://liupeng0518.github.io/2019/09/09/docker/build/build%20busybox/
https://blog.csdn.net/qq_44045338/article/details/109368225
https://www.busybox.net/downloads/
https://stackoverflow.com/questions/49025932/failure-on-cross-compiling-busybox

  1. make ARCH=arm CROSS_COMPILE=arm-unknown-linux-uclibcgnueabi- defconfig
  2. make ARCH=arm CROSS_COMPILE=arm-unknown-linux-uclibcgnueabi- menuconfig
  3. [Disable] Coreutils -> sync -> Enable -d and -f flags
  4. [Disable] Linux System Utilities -> nsenter
  5. [Disable] Linux System Utilities -> fallocate
@tirzasrwn
tirzasrwn / fhs_note.md
Created March 21, 2022 02:04
Filesystem Hierarchy Standard
@tirzasrwn
tirzasrwn / zip_all_folders_command.md
Created March 17, 2022 04:34
Zip all folders command
$ tree -d
+ MyDirectory/
| |
| + Folder_01/
| |
| + Folder_02/
| |
| + Folder_03/
|
@tirzasrwn
tirzasrwn / learning-embedded-linux.md
Last active March 30, 2022 04:49
Learning embedded Linux note

Note

This is a note from this book. I'm using Ubuntu 16.04 for this.

Install require packages

sudo apt-get install autoconf automake bison bzip2 cmake flex g++ gawk gcc gettext git gperf help2man libncurses5-dev libstdc++6 libtool libtool-bin make patch python3-dev rsync texinfo unzip wget xz-utils u-boot-tools

Install crosstool-NG

git clone https://github.com/crosstool-ng/crosstool-ng.git
cd crosstool-ng
@tirzasrwn
tirzasrwn / nc.md
Created January 14, 2022 03:37 — forked from jtbonhomme/nc.md
Using Netcat for File Transfers

Netcat is like a swiss army knife for geeks. It can be used for just about anything involving TCP or UDP. One of its most practical uses is to transfer files. Non *nix people usually don't have SSH setup, and it is much faster to transfer stuff with netcat then setup SSH. netcat is just a single executable, and works across all platforms (Windows,Mac OS X, Linux).

Destination

On the receiving (destination) terminal, run:

nc -l -p 1234 > out.file