Skip to content

Instantly share code, notes, and snippets.

🔳
Making the terminal great again!

Mischievous Meerkat jarun

🔳
Making the terminal great again!
Block or report user

Report or block jarun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jarun
jarun / vim.md
Created Nov 22, 2019
Useful vim tips
View vim.md
daw - delete a word (under cursor)
caw - delete a word (under cursor) and put in inset mode
@jarun
jarun / lookups.md
Last active Nov 1, 2019
frequent man pages and help lookups for programming
View lookups.md
@jarun
jarun / ratio.sh
Last active Jul 6, 2019
Get the size to duration ratio of a media
View ratio.sh
#!/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: ratio.sh | sort -rg
for file in *; do
# get duration in milliseconds->mins
ms=$(mediainfo --Inform="Video;%Duration%" "$file")
@jarun
jarun / split.py
Created May 6, 2019
Split a music track into specified sub-tracks using ffmpeg
View split.py
#!/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
jarun / Termux_from_Ubuntu.md
Last active Nov 20, 2019
How to connect to Termux from Ubuntu desktop
View Termux_from_Ubuntu.md
  1. Generate your ssh key pair on your desktop

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

  3. Run ssh server on your desktop

  4. Copy the file to Termux over SCP

    $ scp arun@192.168.0.100:~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
    

    You can stop ssh server on your desktop now

  5. Install ssh server on Termux

@jarun
jarun / Highlight.vim
Last active Mar 20, 2019
vimscript to highlight visual selection or string under cursor
View Highlight.vim
" script modified from: https://bitbucket.org/sjl/dotfiles/src/b6d64b1c4cdf53060e3c30b3b87a653a30dc85d0/vim/vimrc?at=default&fileviewer=file-view-default#vimrc-3125
"
" ctermbg color code ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
" Usage
" -----
" Add the following to your .vimrc:
" :map <silent> <C-a> :normal! gv"zy<CR>
" Use '\1' to '\9' for different color highlighting. '\0' clears all highlighting.
" In general, a visual selection followed by 1. Esc and 2. ^a will be highlighted.
" If there is no visual selection, the word under cursor will be highlighted.
@jarun
jarun / disassemble.md
Last active Dec 3, 2019
Guide to disassemble
View disassemble.md

prerequisites

  • Compile the program in gcc with debug symbols enabled (-g)
  • Do NOT strip the binary
  • To generate assembly code using gcc use the -S option: gcc -S hello.c

utilities

objdump

@jarun
jarun / fish_noti.md
Last active Aug 8, 2019
notification on command completion (fish shell)
View fish_noti.md

Instead of waiting for long commands to finish one can easily get notifications when they are complete. The following procdure shows how to set his in fish shell.

Requirements: fish shell, notify-send, xdotool

  • Add a new file vi ~/.config/fish/functions/noti.fish with the content below:
function fish_right_prompt
    if test $CMD_DURATION
        # Check if terminal window is hidden
@jarun
jarun / memusage.sh
Last active Apr 10, 2019
Log memory usage by process name or PID with custom delay
View memusage.sh
#!/usr/bin/env bash
## Function to show error and exit
errexit()
{
echo "process not found.";
exit 1;
}
## Check number of arguments passed
@jarun
jarun / Goa tips.md
Last active Apr 8, 2019
Notes from Goa, India trip (22 Oct 2017)
View Goa tips.md

Sunset at Benaulim

  1. Use Google Maps, save Goa offline for quick access. Jio works everywhere.
  2. Buy hats. Goa is hot and humid (between Feb to Dec).
  3. If you reach Madgaon by train and want to go to North Goa, take an auto to the Madgaon Bus stand (around Rs. 120). Book a ticket for the non-stop express bus to the Panjim Bus stand. At Panjim Bus stand, take a KTC prepaid taxi to North Goa.
  4. A nice place to homestay is Joe and Marietta's guesthouse, Calangute Goa. They have all amenities like AC, fridge, hot water, wifi... It's very near to KFC. They will provide numbers to cab and bike services too. But do NOT buy petrol from them even if the lady insists. They charged Rs. 80/ltr when the petrol price in Goa was Rs. 52/ltr on the day. There are petrol pumps everywhere. One can stay in North Goa and visit Old Goa + Panjim by bike.
  5. Autos and cabs will cost you dearly. Hire a bike for a few days (~Rs. 300/day for Honda Activa). No Uber or Ola, thanks to govt
You can’t perform that action at this time.