Skip to content

Instantly share code, notes, and snippets.

Avatar

Mischievous Meerkat jarun

View GitHub Profile
@jarun
jarun / disassemble.md
Last active Oct 15, 2020
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 / Termux_from_Ubuntu.md
Last active Oct 10, 2020
How to connect to Termux from Ubuntu desktop
View Termux_from_Ubuntu.md

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 / netplan.md
Last active Oct 8, 2020
Ubuntu Server 20.04 on Raspberry Pi 4: WiFi configuration from terminal with Netplan
View netplan.md

List the network devices.

$ ls /sys/class/net
eth0  lo  wlan0

Edit the config file.

@jarun
jarun / fish_noti.md
Last active Sep 14, 2020
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 Aug 8, 2020
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 / Fun bugs.md
Last active Jul 16, 2020
Bugs those fascinated me
View Fun bugs.md

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
jarun / chrome_extensions.md
Last active Jul 1, 2020
A collection of useful Google Chrome extensions
View chrome_extensions.md
@jarun
jarun / migrate-fish-history-to-zsh.py
Created Jan 15, 2020 — forked from mateuspontes/migrate-fish-history-to-zsh.py
Migrate fish history to zsh shell (python 2.7)
View migrate-fish-history-to-zsh.py
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
jarun / infinality settings
Last active Jun 15, 2020
infinality-settings.sh
View infinality settings
##################################################################
### INFINALITY ENVIRONMENT VARIABLES FOR EXTRA RUN-TIME OPTIONS ##
##################################################################
#
# These environment variables require that their respective patches
# from http://www.infinality.net have been applied to the Freetype
# installation you are using. They will do abolutely
# nothing otherwise!
#
@jarun
jarun / Travis CI local install
Created Jun 5, 2016
How to install Travis CI locally on Ubuntu 16.04
View Travis CI local install
sudo apt install ruby ruby-dev
sudo gem install travis
# install path: /var/lib/gems/
You can’t perform that action at this time.