Skip to content

Instantly share code, notes, and snippets.

/* The code has been tested on kerenl 5.3
The steps to use the icotl in user space is given in
http://tuxthink.blogspot.com/2011/01/creating-ioctl-command.html
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h> // required for various structures related to files liked fops.
@satishba
satishba / create_sheet_unique_rows.py
Created April 18, 2020 18:07
Create a Spreadsheet of unique rows
#!/usr/bin/env python3
"""
Tested on python 3.6
file1 : Path to the original file
copy: Path to the file to be created having unique rows from file1
"""
import pyoo
@satishba
satishba / create_copy.py
Last active April 14, 2020 06:14
Python script to create a copy of a spreadsheet based on values in another spreadsheet
#!/usr/bin/env python3
"""
Tested on python 3.6
file1: File from where rows need to be copied
file2: File having the reference values
copy : The new file to be created with the required rows.
Update the above three paths before executing the script.
"""
@satishba
satishba / grading_column_pyoo.py
Created April 12, 2020 11:00
Assign gardes based on CGPA
#!/usr/bin/env python3
"""
Tested on python 3.6
Modify the path variable to point to the location of the librecalc file.
Modify the grade dict to suit the grades that you want to assign.
"""
import pyoo
path=""
@satishba
satishba / unique_terms_libre_column.py
Created April 7, 2020 17:46
Python Pyoo script to find the unique items in a column
#!/usr/bin/env python3
"""
Tested on python 3.6
"""
import pyoo
path="/media/satish/5229e5b6-0b7b-44ef-a609-5aaf186c6bc4/data/pro_g/python/pyoo/test.ods"
desktop = pyoo.Desktop('localhost', 2002)
doc = desktop.open_spreadsheet(path)
@satishba
satishba / sum_pyoo.py
Last active April 6, 2020 06:28
Pyoo script to add
#!/usr/bin/env python3
"""
Tested on python 3.6
"""
import pyoo
"""
@satishba
satishba / misc_device_read.c
Last active April 5, 2020 13:17
Example code for registering and reading from a misc char device
/* Code has been tested on linux kernel 5.3*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include<linux/sched.h>
#include <linux/uaccess.h>
#include<linux/slab.h>
#include <linux/miscdevice.h>
@satishba
satishba / proc_kstrcpy.c
Last active April 5, 2020 13:23
Example code for usage of kstrcpy
/*Tested on kernel 5.3*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include<linux/slab.h>
ssize_t size;
@satishba
satishba / proc_read_gettimeofday.c
Last active April 5, 2020 05:27
Example code for getnstimeofday
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include<linux/slab.h>
int len;
char *msg;
@satishba
satishba / readOptions.c
Created March 19, 2020 17:33
Example code to see the usage of get_options.c
#include <linux/module.h>
#include <linux/kernel.h>
#include<linux/sched.h>
int pint=-1;
static __init int getargs(char *str){
char *ret;
int i=0,num;