Skip to content

Instantly share code, notes, and snippets.

View jarun's full-sized avatar

Arun jarun

View GitHub Profile
jarun /
Created May 16, 2021 07:07
How to reinstall network-manager after accidental removal from terminal
  1. Look up the interface
$ sudo iw dev                            
	Unnamed/non-netdev interface
		wdev 0x3
		addr 98:54:1b:0a:9f:16
		type P2P-device
 txpower 0.00 dBm
jarun /
Last active January 14, 2021 02:59
Add HP LaserJet 1020 Plus Printer to Ubuntu
  1. Install package hplip

  2. Run

    hp-setup -i
  3. Download from here.

jarun / Fun
Last active July 16, 2020 10:47
Bugs those fascinated me
View Fun

Bugs those fascinated me

Developers fix thousands of defects in their careers. However, there are always a memorable few. I thought of listing down some of the interesting bugs I came across so far.

1. Messages those reach before sent

One from the early years of my career. I was working on SMS/MMS protocols during the time, After sending out a few lakhs of messages from one handled to another kept beside each other it was seen that even before the message is sent completely from mobile A it reaches mobile B and the user gets the notification.

It was late night but a challenge interesting enough to keep you awake. After a few hours of debugging it was found that the implementation was using a linked list to which it was appending each new message information at the end before sending it out to the lower telephony layer which would confirm asynchronously once the message was successfully sent. However, on receiving the confirmation, it does some bookkeeping and it was searching the list from the head f

jarun /
Last active July 9, 2023 06:01
Ubuntu Server 20.04 on Raspberry Pi 4: WiFi configuration from terminal with Netplan

List the network devices.

$ ls /sys/class/net
eth0  lo  wlan0

Edit the config file.

jarun /
Last active July 17, 2021 19:44 — forked from mateuspontes/
Migrate fish history to zsh shell (python 2.7)
import os
import re
def fish_to_zsh(cmd):
return (cmd.replace('; and ', '&&')
.replace('; or ', '||'))
with open(os.path.expanduser('~/.zsh_history.test'), 'a') as o:
with open(os.path.expanduser('~/.local/share/fish/fish_history')) as f:
for line in f:
jarun /
Last active December 11, 2022 04:58
Useful vim and git tips


daw - delete a word (under cursor)
caw - delete a word (under cursor) and put in insert mode

Remove first 5 characters in each line:


jarun /
Last active November 1, 2019 10:56
frequent man pages and help lookups for programming
jarun /
Last active February 15, 2020 06:28
Get the size to duration ratio of a media
#!/usr/bin/env sh
# Description: POSIZ compliant script to get the size to duration of a media file
# Requires: mediainfo, bc, ls
# For sorted output: | sort -rg
for file in *; do
# get duration in milliseconds->mins
ms=$(mediainfo --Inform="Video;%Duration%" "$file")
jarun /
Created May 6, 2019 15:58
Split a music track into specified sub-tracks using ffmpeg
#!/usr/bin/env python3
Description: split a music track into specified sub-tracks using ffmpeg
target files are saved as variable bit-rate mp3 (lossless)
Usage: split <original_track> <track_list>
import shlex
jarun /
Last active August 30, 2023 12:33
How to connect to Termux from Ubuntu desktop

In this example, we will setup a SSH server on Termux (for Android) and connect to the server from Ubuntu desktop. However, a similar procedure should work with any SSH server.

  1. Generate your ssh key pair on your desktop

    $ ssh-keygen
  2. Check your desktop IP address (say,

  3. Run ssh server on your desktop

  4. Copy the file to Termux over SCP

$ scp arun@ ~/.ssh/authorized_keys