Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / file_to_ascii.md
Last active September 8, 2022 03:12
File to ASCII in Linux

About

Convert file to ASCII. Some transfer protocol only support ASCII. We can still use it by converting our file into ASCII.

Tools

  • uuencode
  • uudecode
  • tar
  • gzip
  • gunzip
@tirzasrwn
tirzasrwn / postgres.md
Last active December 27, 2022 04:11
Postgresql

Setup Postgressql LInux Debian

sudo apt update
sudo apt install postgresql
sudo apt install postgresql-client

# Setting up new password
sudo passwd postgres
@tirzasrwn
tirzasrwn / openconnect.md
Created January 4, 2023 02:35
OpenConnect installation

OpenConnect

The Cisco AnyConnect client can and does work on Linux-based operating systems and you a free to download and install it using its insall shell script, however, the open source community has produced an AnyConnect SSL VPN compatible client called OpenConnect which will be available for in your modern Linux-based OS. For this document, we've used the latest Ubuntu 14.04 Desktop distribution as an example. The following should show you step-by-step how to install and configure OpenConnect for the UoM AnyConnect VPN service.

Installing OpenConnect

Follow these steps and refer to the screenshots to install OpenConnect, some basic knowledge of your Linux-based operating system is assumed.

  • Open Terminal
  • Install OpenConnect from the Ubuntu Universe software repository
$ sudo apt-get install openconnect network-manager-openconnect network-manager-openconnect-gnome
@tirzasrwn
tirzasrwn / aes-256-cbc-test.js
Created March 10, 2023 03:54 — forked from brettscott/aes-256-cbc-test.js
AES 256 CBC encryption between Golang and Node JS
// Node v6.9.0
//
// TEST FILE (cut down for simplicity)
// To ensure Golang encrypted string can be decrypted in NodeJS.
//
let crypto;
try {
crypto = require('crypto');