Skip to content

Instantly share code, notes, and snippets.

View kmjayadeep's full-sized avatar

Jayadeep KM kmjayadeep

View GitHub Profile
@kmjayadeep
kmjayadeep / enable-hibernate-arch-linux.md
Created May 10, 2021 13:52 — forked from klingtnet/enable-hibernate-arch-linux.md
Enable hiberate in Arch Linux usind kernel 4+, grub2 and a swapfile

This guide is based on the hibernate article from the Arch wiki.

  • edit /etc/default/grub and add resume as well as resume_offset kernel parameters
    • resume=UUID=abcd-efgh contains the UUID of the partition on which the swapfile resides. In most cases the swapfile resides in root, to identify the root parition's UUID run blkid or lsblk -O.
    • resume_offset=1234 is the offset of the swapfile from the partition start. The offset is the first entry in the physical_offset column of the output of filefrag -v /swapfile.
    • update grub: grub-mkconfig -o /boot/grub/grub.cfg
    • example: GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=75972c96-f909-4419-aba4-80c1b74bd605 resume_offset=1492992"
  • add the resume module hook to /etc/mkinitcpio.conf:
    • HOOKS="base udev resume autodetect ...
  • rebuild the initramfs mkinitcpio -p linux
@kmjayadeep
kmjayadeep / xmlparser.html
Created March 10, 2017 16:52
Simple xml parser example
<html>
<head>
<title>
XML Parser
</title>
<style>
body {
font-family: monospace;
}
@kmjayadeep
kmjayadeep / chi x*x + y*y - x*y (16 bit).asm
Created December 1, 2016 16:52
chi x*x+y*y-x*y 16bit in 8051
;inputs
mov dptr,#0
movx a,@dptr
mov r0,a
inc dptr
movx a,@dptr
mov r1,a
inc dptr
movx a,@dptr
mov r2,a
@kmjayadeep
kmjayadeep / 8051_palindrome.asm
Created December 1, 2016 15:52
8051 program for checking palindrome
mov dptr,#0000
movx a,@dptr
mov r1,a
mov b,#0
mov r0,#8
loop:
rrc a
mov r1,a
mov a,b
rlc a
@kmjayadeep
kmjayadeep / gobackn.cpp
Created November 29, 2016 16:11
Go back N Software simulation
/*
Go Back-N SW simulation
*/
#include<iostream>
#include<cstring>
#include<random>
#include<map>
#include<climits>
@kmjayadeep
kmjayadeep / selective_repeat.cpp
Created November 29, 2016 13:29
Selective Repeat software simulation
/*
Selective repeat SW simulation
*/
#include<iostream>
#include<random>
#include<queue>
#include<map>
using namespace std;
@kmjayadeep
kmjayadeep / producer_consumer.cpp
Created November 28, 2016 16:05
Producer Consumer problem implementation in cpp
#include <iostream>
#include <pthread.h>
#include <semaphore.h>
#include <random>
#include <unistd.h>
using namespace std;
#define BUFFER_SIZE 10