mcrblg-header-image

search

CronTab @Reboot

Published on 2023-05-19 in Linux

You can use the @reboot keyword in crontab to start a shell script at system startup but here is why this isn’t a very good solution to do that.

The problem is that if you don’t shut down the system cleanly on the next startup this message will pop up and cron will simply skip over running your command.

"Skipping @reboot jobs -- not system startup"

The solution is easy, just use a systemd service.

/etc/systemd/system/service_name.service
------------------------------------------
[Unit]
Description=some description
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=root
ExecStart=/home/user/script.sh

[Install]
WantedBy=multi-user.target

 

UnixDaemon – How Does Cron Reboot Work


Useful RegEdit Commands

Published on 2023-02-24 in Windows

Disable Firefox Update Prompt

run in cmd

reg ADD HKLM\SOFTWARE\Policies\Mozilla\Firefox /v DisableAppUpdate /t REG_DWORD /d 1 /f

or run ff_update_dis.reg

Disable Windows Keys

reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoWinKeys /t REG_DWORD /d 1 /f

or run win_key_dis.reg

Disable Shutdown Prompt Ending Application

reg ADD HKCU\Control Panel\Desktop /v AutoEndTasks /t REG_SZ /s "1" /f

or run win_end_task.reg


RegEx: My Greatest Fear

Published on 2023-01-30 in Linux

Regex, Sed, and AWK are freaks in programming but they are pretty simple, well not at the beginning though.

Here I summarize some of the most amazing ones for RegEx

  1. To Be or Not To Be, is possible with: LookAround
  2. Stop Worrying! Regex101 is all you need to know

Qt MSVC vs MinGW

Published on 2022-12-31 in Windows

So exciting that even after 13 years of introducing to Qt by my great teacher, Mani Monajjemi there’s still a lot to learn.

I was trying to use WinRT with Qt today and now after so long time sticking to MinGW, I’m switching to MSVC. Here are the 4 reasons

  1. MinGW is opensource but deep down if you are in Win32, their compiler always offers better API compatibility
  2. WinRT is available only on MSVC
  3. If you ever get around to some dll that simply doesn’t work with your project, it’s because MinGW and MSVC ABI are not the same. and probably that DLL was compiled by MSVC not MinGW. Same OS and still a different ABI, sounds too Windowsy to me
  4. Because you are on Windows, show some support to the closed-source community!

COM Object and C++

Published on 2022-07-31 in Windows
• CoInitialize: Initializes the COM library for use by the calling thread, sets the thread’s concurrency model, and creates a new apartment
• CoInitializeEx: More advanced version CoInitialize that specify the thread’s concurrency model
• CoUninitialize: Should be called on deconstructor

And Bash Is Awesome!!!

Published on 2022-07-08 in Linux, Uncategorized

Here I list cool bash tricks I learned:

Bash Heredoc


Chrome DevTools Remote Control in Linux Bash

Published on 2022-05-06 in Linux

Ok the title is a bit long but why google create such a nice debug interface and make it so difficult to access it.

1. open chrome with remote debug enabled

chromium --remote-debugging-port=9222 https://github.com/

2. Install websocat to create websocket to chrome

sudo pacman -S websocat

3. Find magic chrome ws url. To do that visit following url

http://127.0.0.1:9222/json/list

4. Connect to the websocket

websocat ws://127.0.0.1:9222/devtools/browser/<GUID>

5. Execute magic command. Here just scrolling the page

{"id": 1, "method": "Runtime.evaluate", "params": {"expression": "document.documentElement.scrollTop = 600"}}

Few Notes


WDM, WDK, DDK, HDK, SDK and ….

Published on 2021-05-21 in Windows

On the way to develop a driver for Scarlet Solo Gen3 to harness the power of Shure SM57 Dynamic Microphone.

Useful links to preserve:

  1. Microsoft – Universal Audio Architecture: Guideline to for Sound Card Without Propriety Driver

  2. Microsoft – Introduction to Port Class

  3. Microsoft – AVStream Overview
  4. Microsoft – WDM Audio Terminology

  5. Microsoft – Kernel Streaming
  6. Microsoft – KS Filters

Update 1: Finished developing! Here is the link to the released driver

GitHub – BijanBina/BAudio Windows 7 x64


ZC702 FMCOMMS3 PetaLinux Starting Guide

Published on 2019-07-08 in Electrical Engineering, Linux, Xlinx

The combination of FMCOMMS3 and PetaLinux is working only on Ubuntu 16.04 LTS, PetaLinux 2018.3, Vivado 2018.3

Required Packages:

sudo apt-get install -y gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev zlib1g:i386 screen pax gzip

Installing PetaLinux

Create a new directory

sudo mkdir -m 755 PetaLinux 
sudo chown bijan ./PetaLinux

Install PetaLinux by running the following command.

./petalinux-v2018.3-final-installer.run .

Building Vivado Project

Clone Analog Devices HDL repository

git clone https://github.com/analogdevicesinc/hdl.git
git clone https://github.com/analogdevicesinc/meta-adi.git

Make HDL Project

export PATH="$PATH:/mnt/hdd1/Vivado/Vivado/2018.3/bin"
make fmcomms2.zc702

Creating a New PetaLinux Project:

source ../settings.sh
petalinux-create --type project --template zynq --name fmcomms3_linux

Then change directory to the created project directory.

petalinux-config --get-hw-description=<hdf file directory>

set Subsystem AUTO Hardware Settings -> Advanced bootable
images storage setting -> u-boot env partition settings -> image
storage media -> primary sd

/home/bijan/Projects/ADI_Linux/meta-adi/meta-adi-core
/home/bijan/Projects/ADI_Linux/meta-adi/meta-adi-xilinx

Download following files and write it down to meta-adi/meta-adi-xilinx/recipes-bsp/device-tree/files

device-tree.bbappend

pl-delete-nodes-zynq-zc702-adv7511-ad9361-fmcomms2-3.dtsi

zynq-zc702-adv7511-ad9361-fmcomms2-3.dts

Build PetaLinux:

To build petalinux run following command inside petalinux directory

petalinux-build

In case of error remove -e from first line of system-user.dtsi file inside build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+b7466bbeee-r0/system-user.dtsi

Program ZC-702 FPGA Board Through JTAG

Install Digilent Drivers

<Vivado Install Dir>/data/xicom/cable_drivers/lin64/install_script/install_drivers/install_drivers

To program the board using jtag interface. First we should package the kernel with the following command.

petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot --force

Then login to the root account and run following commands.

petalinux-package --prebuilt --fpga images/linux/system.bit --force
petalinux-boot --jtag --prebuilt 3 -v
petalinux-boot --jtag --fpga --bitstream images/linux/system.bit

Program ZC-702 FPGA Board Through SD-Card

Enable SW16.3 & SW16.4 on ZC702 Board.

Generate BOOT.BIN file by executing following command:

petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot --force

copy image.ub and BOOT.BIN to SD-Card

Customize Username and Password

To change username and password open

meta-adi/meta-adi-xilinx/recipes-core/images/petalinux-user-image.bbappend

Change analog to your desired password. If you want to remove login requirement comment EXTRA_USERS_PARAMS and enable debug-tweak in petalinux-config -c rootfs.

Change UART BaudRate

To change UART baudrate run

petalinux-config

go to Subsystem AUTO Hardware Settings -> Serial Settings -> System stdin/stdout baudrate


Useful Links

Analog Wiki – Building with Petalinux

Analog Wiki – HDL Releases

GitHub – Analog Device No OS


AHK Binding not Works on All Application

Published on 2017-08-28 in Windows

I use AutoHotkey  in almost all my application but I notice some Qt applications (Like ADS) had some difficulty interpreting the AHK keys correctly. The problem turns out to be affiliated with UAC and Admin rights rather than the Qt library. To solve the issue simply add following lines to the top of your AHK scripts that you want to be applied on the specific app.

#SingleInstance Force
SetWorkingDir %A_ScriptDir%
if not A_IsAdmin
   Run *RunAs "%A_ScriptFullPath%" ; Run Script as admin

This problem arises when you open a software instance with the admin rights while the AHK script doesn’t spawn with the same permission level. The above script simply run AHK with admin rights too so whether application is with or without admin right AHK script will always be able to set the key bindings.

Team Solid Squad


‹ previous posts
close
menu