Skip to content

Instantly share code, notes, and snippets.

View jarun's full-sized avatar

Arun jarun

View GitHub Profile
@jarun
jarun / disassemble.md
Last active April 26, 2024 14:18
Guide to disassemble

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 / network-manager.md
Created May 16, 2021 07:07
How to reinstall network-manager after accidental removal from terminal
  1. Look up the interface
$ sudo iw dev                            
phy#0
	Unnamed/non-netdev interface
		wdev 0x3
		addr 98:54:1b:0a:9f:16
		type P2P-device
 txpower 0.00 dBm
@jarun
jarun / Termux_from_Ubuntu.md
Last active April 1, 2024 23:03
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, 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

@jarun
jarun / fish_noti.md
Last active August 2, 2023 17:36
notification on command completion (fish shell)

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 / remexe.py
Created October 4, 2017 20:55
Remove executable permission for media files recursively
#!/usr/bin/env python3
import os
import stat
extns = ['.aac', '.avi', '.flac', '.m3u', '.m4a', '.mkv', '.mp3', '.mp4', '.smi', '.srt', '.sub', '.webm', '.wma']
for root, dirs, files in os.walk('.'):
for entry in files:
fname, ext = os.path.splitext(entry)
@jarun
jarun / netplan.md
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
jarun / cupcakes.md
Last active April 23, 2023 17:14
Random collection of useful commands

A collection of awesome commands, functions, aliases to save your time

Play random music from your media storage:
# BASH shell

boom()                                                                           
{                                                                                
 find $@ -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.webm" -o -iname "*.wma" \) | sort -R | head -n 100 | xargs -d "\n" smplayer > /dev/null 2>&1 &
@jarun
jarun / vim_git.md
Last active December 11, 2022 04:58
Useful vim and git tips

vim

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

Remove first 5 characters in each line:

:%s/^.{0,5}//

@jarun
jarun / split.py
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
jarun / Travis CI local install
Created June 5, 2016 19:00
How to install Travis CI locally on Ubuntu 16.04
sudo apt install ruby ruby-dev
sudo gem install travis
# install path: /var/lib/gems/