Skip to content

Instantly share code, notes, and snippets.

View jacobabrahamb4's full-sized avatar

Jacob Abraham jacobabrahamb4

View GitHub Profile
@jacobabrahamb4
jacobabrahamb4 / bdiff.py
Last active March 18, 2024 12:05
Display diff between two commits. Tested working on ubuntu and Windows. Install beyond compare or meld before use. Works well with small-medium projects.
#!/usr/bin/env python3
"""
How to use this script?
-----------------------
Prerequisites:
1. python3, git and Beyond Compare/meld should be installed.
LINUX:
1. Create a directory ~/bin in your home directory.
@jacobabrahamb4
jacobabrahamb4 / flash.sh
Created March 9, 2024 07:39
Android AOSP flash.sh
#!/bin/bash
#sudo ./adb kill-server
#sleep 2
#sudo ./adb start-server
#sleep 3
#sudo ./adb root
#sudo ./adb remount
sudo adb devices
sudo adb reboot-bootloader
sleep 3
@jacobabrahamb4
jacobabrahamb4 / push.sh
Last active March 8, 2024 17:25
push app to android device
#!/bin/sh
if [ $# -gt 0 ]; then
adb root
sleep 1
adb remount
sleep 1
for i in "$@"
do
adb shell sync
adb shell rm -rf /"$i"
@jacobabrahamb4
jacobabrahamb4 / stack_using_linked_lists.c
Created April 18, 2013 18:33
stack using linked lists, will be edited later.
//http://www.zentut.com/c-tutorial/c-stack-using-pointers/
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int data;
struct node* next;
} node;
@jacobabrahamb4
jacobabrahamb4 / single_linked_list.c
Created April 18, 2013 18:01
single linked list, only functions are included, will be implemented later.....
//http://www.zentut.com/c-tutorial/c-linked-list/
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int data;
node* next=NULL;
} node;
@jacobabrahamb4
jacobabrahamb4 / abs_float.c
Created April 14, 2013 14:16
absolute value of float
#include<stdio.h>
int main()
{
float x;
printf("Enter the float number:\n");
scanf("%f", &x);
// copy and re-interpret as 32 bit integer
int casted_to_int = *(int*)&x;// float pointer is converted to an integer pointer and dereferenced.
@jacobabrahamb4
jacobabrahamb4 / pipelining.txt
Last active December 16, 2015 04:39
Pipelining concept in computer architecture
//http://discuss.itacumens.com/index.php?topic=7635.0
Pipelining concept in computer architecture
In this Module, we have three lectures,
1. Introduction to Pipeline Processor
2. Performance Issues
3. Branching
@jacobabrahamb4
jacobabrahamb4 / bitwise.c
Created April 13, 2013 13:41
using bitwise operators....
//http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/
#include <stdio.h>
void check_even_odd(int);
void check_nth_bit_is_set(int , int);
int set_the_nth_bit(int,int);
int unset_the_nth_bit(int,int);
int toggle_nth_bit(int, int);
int turn_off_the_righmost_one(int);
@jacobabrahamb4
jacobabrahamb4 / debugging_macros.c
Last active December 16, 2015 03:39
using some built in macros in c for debugging purpose
// its documented here in this link http://www.delorie.com/gnu/docs/gcc/cpp_21.html
#include <stdio.h>
#include <stdlib.h>
#define PRINTINFO(message) print_info(__FILE__, __LINE__, __DATE__, __TIME__, message)
void print_info(const char* file,int line, const char* date, const char* time, const char* message)
{
printf("FILE is : %s\n ", file);
@jacobabrahamb4
jacobabrahamb4 / convert_to_uppercase.c
Last active December 16, 2015 03:38
convert to upper case
// find more explanations here
// https://www.securecoding.cert.org/confluence/display/seccode/STR30-C.+Do+not+attempt+to+modify+string+literals
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *strptr = NULL, *copy = NULL;
strptr = "Jacob Abraham"; // this will be stored in a read only location hence cannot be modified.