Skip to content

Instantly share code, notes, and snippets.

View aakbar5's full-sized avatar

asad akbar aakbar5

View GitHub Profile
@aakbar5
aakbar5 / ffmpeg -- Reduce video size
Last active November 26, 2023 09:51
Video -- Reduce video size
Using FFMPEG
---
ffmpeg -i input.mp4 -s 320x240 -b 64k -vcodec mpeg1video -acodec copy output.mp4
Change parameters to get tradeoff quality and size
- Resolution via -s 320x240
- Bitrate via -b 64k
Using AVCONV
@aakbar5
aakbar5 / dts <> dtb
Created April 5, 2018 17:07
dts <> dtb
# To convert dts file into dtb
<kernel-source>/scripts/dtc/dtc -I dts -O dtb <dts_file> -o <dtb_file>
# To convert dtb to dts
<kernel-source>/scripts/dtc/dtc -I dtb -O dts <dtb_file> -o <dts_file>
# Both of above commands are using dtc built with linux kernel source.
# However you can also use dtc binary comes with ubuntu packages. For this you
# need to install following package:
# Script is interested to take
# - a flag
# - an option which takes a parameter
arg_list=$(getopt -o bp: --long boolean,param: -- "$@")
eval set -- "$arg_list"
while [ $# -gt 0 ] ; do
case "$1" in
-b | --boolean)
echo "Parameter @ flag"
shift
@aakbar5
aakbar5 / .desktop
Last active May 2, 2023 18:48
Ubuntu .desktop file
[Desktop Entry]
Type=Application
Name=EclipseC++
GenericName=Eclipse
Comment=Eclipse for development
Exec=/path/to/eclipse
Icon=/path/to/icon.xpm
Terminal=false
MimeType=text/plain;
Categories=Development;IDE
@aakbar5
aakbar5 / GNU_HASH
Created March 1, 2017 12:31
GNU_HASH
Yocto build was showing a warning of "QA Issue: No GNU_HASH in the elf binary".
- The fix was to make sure that linker command line used by the respective application is using parameters used by Yocto build system.
- Just for information $(LDFLAGS) used by Yocto is having -Wl,--hash-style=gnu.
Ref: For inside of GNU_HASH: https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections
@aakbar5
aakbar5 / set or change the root password in Yocto
Created January 25, 2017 10:55
set or change the root password in Yocto
inherit extrausers
EXTRA_USERS_PARAMS = "usermod -P hello root;"
- This sets the root password to "hello".
- These lines can be added into your core-image-base.bbappend file.
@aakbar5
aakbar5 / cppcheck - installation
Last active September 10, 2020 21:09
cppcheck
# Pre-built package (# Ubuntu 18.04.3 LTS)
sudo apt update
sudo apt install cppcheck
# Build from code
wget https://github.com/danmar/cppcheck/archive/2.1.tar.gz
tar zxvf 2.1.tar.gz
cd cppcheck-2.1
mkdir build
@aakbar5
aakbar5 / include-what-you-need - installation
Last active September 10, 2020 21:08
include-what-you-need
# Ubuntu 18.04.3 LTS
# Installation
sudo apt-get update
sudo apt-get install -y build-essential cmake git zlib1g-dev libncurses5-dev llvm-6.0-dev libclang-6.0-dev libclang-6.0-dev clang-6.0
git clone https://github.com/include-what-you-use/include-what-you-use.git iwyu.git
cd iwyu.git
git checkout clang_6.0
mkdir -p build
cd build
cmake -DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-6.0 ..
@aakbar5
aakbar5 / function.sh
Created December 31, 2019 12:09
Bash function
# A simple function which takes
# no parameters and returns nothing
function fun1() {
echo "A simple function"
}
# A function which takes parameters
# and return nothing
function fun2() {
echo "Fun:: Number of parameters: ${#@}"
@aakbar5
aakbar5 / dup2_usage.c
Last active December 27, 2019 11:37
dup2 usage
// A simple example of how dup2 can be used
const char* msg = "Text written by standard file descriptor\n";
int fd = open("dup2_test.txt", O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
write(fd, msg, strlen(msg));
/* Map stdout to our file */
dup2(fd, STDOUT_FILENO);
printf("Text written by dup @ stdout file descriptor\n");
close(fd);