Skip to content

Instantly share code, notes, and snippets.

View dasbluehole's full-sized avatar

Ashok Shankar Das dasbluehole

  • Cuttack, Odisha,India
View GitHub Profile
@dasbluehole
dasbluehole / sysinfo.py
Created August 31, 2022 15:42
CPU and Memory information using python on Linux
#cpu info mem info by ashok.s.das@gmail.com
#reads and parses /proc/cpuinfo and /proc/meminfo to obtain information
def parse_cpu_info():
info=dict()
try:
f=open('/proc/cpuinfo','r')
except IOError:
return{}
while True:
line = f.readline()
@dasbluehole
dasbluehole / reader.c
Created July 25, 2022 04:34
Scanner class kind of input for C
/*
* reader.c
*
* Copyright 2022 Ashok Shankar Das <ashok@localhost.localdomain>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@dasbluehole
dasbluehole / Primes.module
Created June 22, 2022 05:59
Gambas3 Primes routines
' Gambas module file
Public Sub Main()
Dim l_bound, u_bound As Integer
Print "Primes between a range [Note: 1 is special and 2 is even Prime]"
Print "Input lower bound (should be greater than 2)"
Input l_bound
@dasbluehole
dasbluehole / cnroot.c
Created December 5, 2020 08:29
nth root of any number
//finding n nth root of any number.
#include <stdio.h>
#include <math.h>
#include <complex.h>
// find nth root of c and store it in root array
void cnroot(complex c, int n, complex *root)
{
double m = cabs(c);
double th = carg(c);
for(int i=0; i< n; i++)
@dasbluehole
dasbluehole / Simplex.c
Created December 2, 2020 07:34
Simple Complex number and operators implementations. It also calculates nth roots of any number. See the main() function.
/*
* simplex.c
*
* Copyright(C) 2020 Ashok Shankar Das <ashok.s.das@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*