Categories
linux

How to Start a Fresh Raspberry Pi without Monitor

I mean using SSH, because HDMI, mouse, keyboard, and monitor will eat up the whole space in my desk.

Prepare the Raspberry Pi OS

Firstly we need to get our microSD card with bootable Raspberry Pi OS. I recommend to use Raspberry Pi Imager to make this process easier. We just need 3 steps, download the Raspberry Pi Imager then chose our preferred OS, select the SD card, then write.

Access SSH to Raspberry Pi

By default, SSH access is not allowed. After we wrote the image of Raspbian on our SD card. Create an empty file called ssh inside the boot partition. This will enable the SSH access to your Raspberry Pi.

Raspberry Pi WIFI Auto Connect

Next, just access the Raspberry Pi using ethernet cable by using the IP address. But if we prefer to use wifi, we need to enable the auto-connect to the wifi. Still inside the boot partition, in the same folder, create a file called wpa_supplicant.conf and write down like this:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
scan_ssid=1
ssid="your_wifi_ssid"
psk="your_wifi_password"
}

Change the paramater wifi SSID and password to match our router and save the file.

Now each time you boot up the Raspberry Pi, using your PC in the same network, you can find your Raspberry Pi already connected to the network without any user interface needed.

Finding the Raspberry Pi IP Address

There are many ways to find the Raspberry Pi IP address if we connect the Raspberry Pi via DHCP router or local network. Usually I used arp-scan for this. Install the arp-scan on your host PC:

sudo apt install arp-scan

Then scan your local network by using:

sudo arp-scan -l

ibndias@shaheen:~$ sudo arp-scan -l
 Interface: eno1, type: EN10MB, MAC: xx:xx:xx:xx:xx:xx, IPv4: 10.0.3.XXX
 Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
 10.0.3.X    xx:xx:xx:xx:xx:xx   (Unknown)
 10.0.3.XX    xx:xx:xx:xx:xx:xx   EFM Networks
 10.0.3.XX    xx:xx:xx:xx:xx:xx   NETGEAR
 10.0.3.XXX    xx:xx:xx:xx:xx:xx   Samsung Electronics Co.,Ltd
 10.0.3.XXX    xx:xx:xx:xx:xx:xx   Apple, Inc.
 10.0.3.176    xx:xx:xx:xx:xx:xx   Raspberry Pi Trading Ltd

Here you can see that our Raspberry Pi IP is 10.0.3.176. We can start to connect via SSH by using default account.

ssh pi@10.0.3.176

And the default password is raspberry.

ibndias@shaheen:~$ ssh pi@10.0.3.176
 Linux raspberrypi 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l
 The programs included with the Debian GNU/Linux system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.
 Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
 permitted by applicable law.
 Last login: Wed Nov 18 09:37:57 2020
 SSH is enabled and the default password for the 'pi' user has not been changed.
 This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
 pi@raspberrypi:~ $

That’s it, now we can use our Raspberry Pi without cluttering our desk. πŸ˜‰

Categories
linux

How to Fix Raspberry Pi SSH Hangs or Not Responding

I just set up a Raspberry PI 4 Model B in the laboratory to automatically connect to the lab’s router. I found that each random minutes the SSH is hangs and not responding.

Adding IPQoS cs0 cs0 line to the end of /etc/ssh/sshd_config file will fix the issue. πŸ™‚

Categories
linux Programming

Install Xilinx in Batch Mode

I just got some problem with Xilinx 2020.1 installation on my Pop OS. The installer was stuck and gives me error message:

ibndias@shaheen:~/Downloads$ ./Xilinx_Unified_2020.1_0602_1208_Lin64.bin 
Verifying archive integrity... All good.
Uncompressing Xilinx Installer...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Exception in thread "SPLASH_LOAD_MESSAGE" java.lang.IllegalStateException: no splash screen available
	at java.desktop/java.awt.SplashScreen.checkVisible(Unknown Source)
	at java.desktop/java.awt.SplashScreen.getBounds(Unknown Source)
	at java.desktop/java.awt.SplashScreen.getSize(Unknown Source)
	at com.xilinx.installer.gui.H.run(Unknown Source)
Exception in thread "main" java.lang.IllegalStateException: no splash screen available
	at java.desktop/java.awt.SplashScreen.checkVisible(Unknown Source)
	at java.desktop/java.awt.SplashScreen.close(Unknown Source)
	at com.xilinx.installer.gui.G.b(Unknown Source)
	at com.xilinx.installer.gui.InstallerGUI.G(Unknown Source)
	at com.xilinx.installer.gui.InstallerGUI.e(Unknown Source)
	at com.xilinx.installer.api.InstallerLauncher.main(Unknown Source)

This seems like the GUI problems on the installer. So let’s just continue using batch mode.

./Xilinx_Unified_2020.1_0602_1208_Lin64.bin --noexec --target ~/xilinx-installer

The files will be extracted on ~/xilinx-installer folder. Move on that folder then run:

./xsetup -b AuthTokenGen

Make sure you already have Xilinx account. Now create configuration file.

./xsetup -b ConfigGen

Now install using this commands:

./xsetup --batch Install --agree XilinxEULA,3rdPartyEULA,WebTalkTerms --location ~/Xilinx/Vivado --config "//.Xilinx/install_config.txt"

And here is the list of flags we used. Try use./xsetup --help to get more information.

--batch Install: will stop the gui installer
--agree XilinxEULA,3rdPartyEULA,WebTalkTerms : is for agreeing to the terms and conditions for those three things
--location ... : is where you want to install it
--config ... : is the location of the config file you generated

Now wait for it to be finish. It took a long time for me, so you can just do another thing while waiting. πŸ™‚

Reference: Arch Linux Forum

Categories
linux Programming

How to View .dot Files in Ubuntu

I was working with LLVM recently to create a callgraph using opt -view-cfg. But unfortunately it doesn’t work. Here is what I got instead:

ibndias@SHAHEEN-XPS15:~/Documents/Projects$ opt -view-cfg file.bc
WARNING: You're attempting to print out a bitcode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bitcode first-hand, you
can force output with the `-f' option.
Writing '/tmp/cfg.identity-199090.dot'… done.
Trying 'xdg-open' program… Remember to erase graph file: /tmp/cfg.identity-199090.dot
ibndias@SHAHEEN-XPS15:~/Documents/Projects$ gio: file:///tmp/cfg.identity-199090.dot: No application is registered as handling this file

This means there is no application registered for handling .dot files. Even if I already installed graphviz.

Solution is, install xdot.

sudo apt install xdot

Now you can opt -view-cfg to see the .bc as callgraph.

Categories
Uncategorized

How to Hide Wine System Tray

Install this gnome extension: https://extensions.gnome.org/extension/1674/topiconsfix/

This will move wine system tray to your real ubuntu/gnome system tray.

Enjoy your life.

Categories
linux Programming

GIT Tutorial: How to Push to a New Repository

Set up your global git configuration first.

git config --global user.name "Your Name"
git config --global user.email "id@your.site"
  • If you want to create a new repository:
git clone ssh://id@your.site/some-repo.git
cd argh
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
  • Or just push the existing folder into repository:
cd existing_folder
git init
git remote add origin ssh://id@your.site/some-repo.git
git add .
git commit -m "Initial commit"
git push -u origin master
  • Or maybe push existing Git repository:
cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://id@your.site/some-repo.git
git push -u origin --all
git push -u origin --tags

That’s it! It is simple but it helps a lot.

Categories
linux

How to Create Identical Image of USB Device

Hi, currently I am backing up my micro SD card contents and I’m using dd for that.

You can start listing your usb device using:

$ sudo fdisk -l

After you get the USB address, for example mine is /dev/sdb, you can start creating a copy images. Here I tried to put the image file as ~/usb_clone

$ sudo dd if=/dev/sdb of=~/usb_clone

To restore the image into the USB device, swap the parameter,

$ sudo dd if=~/usb_clone of=/dev/sdb

If you want to view the files without writing on another USB device, you can mount your current image and take a look at the contents,

mount ~/usb_clone /mnt/usb_clone -o loop

That’s it, quite easy isn’t?

Categories
kindle

How to Remove Ads (Special Offers) on Kindle

Wait, this is legal and halal way, so keep calm okay.

So I just bought a Kindle Paperwhite 4 (2019 edition), and it was really awesome! This is the first time I see an e-ink display and it was crisp, comfortable to look for a long time which is really good for reading. πŸ™‚

I bought the version with an ads on it, which keep showing on homepage and screensaver. However later did I know that this ads can be removed legally without any hacks or even jailbreak. I will tell you how…

First open your browser, then login to your Amazon account.

Then open the contact support page: https://www.amazon.com/gp/help/customer/contact-us

Select your kindle device, the choose “Issues with Promotion or Deals” like in the picture below.

The, click chat, just like what I did.

That’s it, no need to pay! Enjoy reading without any disturbance. πŸ™‚

Categories
Islam & Sunnah

High Quality Al-Quran PDF

Recently I found an interesting site which is open-source, it was globalquran.com. The site is perfect, they home page is complete, and also the have download pages for high quality PDF.

I have been searching around google for high quality pdf for Al-Qur’an, I even opened the second page of google (wow!), but what I could only find was just scanned version of Al-Qur’an. Then finally I ended up in this site. Perfect PDF for me is high quality text (not scanned), provides translation (it would be perfect if they have indonesian translation), and also have utsmani fonts. So here it goes, Global Quran have it all.

I”ll leave the link below.

Global Quran, Download PDF

May Allah guide us. πŸ™‚

Categories
Programming

How to View Pointer as Array in Visual Studio Code

It is irritating when you have to write and memorize this syntax in the middle of debugging, but let me just put it in here for future use:

*mypointer@10

Replace mypointer with your pointer name, and replace 10 with how much array you want to view.

The ,h at the end is for showing the value as hex, it’s optional. πŸ™‚

Good to read: https://github.com/Microsoft/vscode-cpptools/issues/172