On Makefiles, an advanced tutorial

Makefiles Makefiles are an indispensable tool when it comes to standardizing things like build processes, and certain automation tasks. The Makefile and gnu make at this point is over 40 years old, and while its got a few hiccups and is a bit rough around the edges, its quite widely adopted and allows developers to work seamlessly across projects simply due to the presence of the humble makefile. What I aim to do in this blog post is simple....

January 2, 2022 · 9 min · Yashodhan Ghadge

Shortcuts on VIM

Vimrc Generally, as a devOps engineer, I have to edit a lot of config files on remote servers, and these always almost have vim installed. Coincidentally over the years I have taken up vim quite swimmingly, however when I am SSH’d into a server I find it hard to keep turning on a few vim flags that improve the overall QOL. So I have this tiny .vimrc that I use....

March 29, 2021 · 1 min · Yashodhan Ghadge

Bluetooth and wifi broadcomm drivers

Get Bluetooth working on brodcomm drivers So if you install the WiFi drivers, you will mostly have the bluetooth not working, to fix this follow these steps lsusb | grep Bluetooth you’ll get: Bus 001 Device 004: ID 0a5c:21d7 Broadcom Corp. BCM43142 Bluetooth 4.0 We nee the ID 0a5c:21d7 and BCM43142 bits now do dmesg | egrep -i 'blue|firm' and you’ll probably get: bluetooth hci0: Direct firmware load for brcm/BCM.hcd failed with error -2...

1 min · Yashodhan Ghadge

Docker Install (And ECR login)

install docker Run these commands sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" Some times the above command gives an error: malformed input, in that case, please do Add the line deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable to /etc/apt/sources.list.d/addtional-repositories.list (create the file if it does not exist) Rest of the steps are the same...

2 min · Yashodhan Ghadge

EC2 attach EBS Volumes

link for reference https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html Attach a volume to an EC2 Instance SSH into the EC2 instance use lsblk to get the device name, full path is now /dev/ check if vol is already init with a file system sudo file -s /dev/<name_of_device> - 1 if output is just data then there is no filesystem on it, make one on it now mkfs -t [ext4| XFS] /dev/<name_of_device> (may need sudo) run 1 again to ensure it is written to the block device...

2 min · Yashodhan Ghadge

Kafka Install

Download Kafka wget https://mirrors.estointernet.in/apache/kafka/2.5.0/kafka_2.12-2.5.0.tgz untar the file sudo tar xvf kafka_2.12-2.5.0.tgz cd to configruation directory cd kafka_2.12-2.5.0/config edit server.properties with # The id of the broker. This must be set to a unique integer for each broker. broker.id=30 # A comma seperated list of directories under which to store log files log.dirs=/tmp/kafka-logs advertised.host.name=<ip address of host> # add all 3 zookeeper instances ip here zookeeper.connect=<i>:2181,<ip>:2181,<ip>:2181 zookeeper.connection.timeout.ms=6000 from the kafka root directory do...

1 min · Yashodhan Ghadge

Netcat tips and tricks

check if port is up nc -zvw3 [hostname or ip] [port] there will be a success output if the port is open else it will either give no output or say connection refused A more detailed examples nc -vz -w 5 127.0.0.0 21 8000-8101 23 w - timeout in seconds 8000-8101 check the ports from 8000 to 8101 (both inclusive) additionally check the ports 21 and 23

1 min · Yashodhan Ghadge

Pihole install and setup

Installation https://github.com/pi-hole/docker-pi-hole run docker compose script to use my setup please use this is repo https://gitlab.com/codexetreme/pihole_server to clone it do git clone https://gitlab.com/codexetreme/pihole_server pihole installation hiccups On ubuntu the pesky systemd will cause issues, so from the docs of pihole sudo systemctl disable systemd-resolved.service sudo systemctl stop systemd-resolved.service sudo nano /etc/NetworkManager/NetworkManager.conf Add dns=default under [main] so that the file contents look like what is shown below: [main] plugins=ifupdown,keyfile dns=default Visit the web gui goto 0....

1 min · Yashodhan Ghadge

Rsync

Rsync Use it sync between local and remote environments rsync -azP source destination -a option The -a option is a combination flag. It stands for “archive” and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions. It is more commonly used than -r and is usually what you want to use. -n, -dry-run Always double-check your arguments before executing an rsync command. Rsync provides a method for doing this by passing the -n or –dry-run options....

1 min · Yashodhan Ghadge

SSH Tips and tricks

to allow a host to login add their public key to authorized_keys file in .ssh folder. to create it do touch authorized_keys and then do cat <KEYNAME>.pub >> authorized_keys to disable password auth goto /etc/ssh/sshd_config and then set PasswordAuthentication no

1 min · Yashodhan Ghadge