Skip to content

Instantly share code, notes, and snippets.

View kneerunjun's full-sized avatar
🖥️
Working for the love of programming

kneerunjun kneerunjun

🖥️
Working for the love of programming
View GitHub Profile
/*
date : 25-AUG-2017
author : kneerunjun@gmail.com
purpose : to try measuring Analog inputs on Rpi using an ADS1115 over I2C and then connect a MQ135 Co2 measurement unit
compilation : gcc ./i2ctest.c -o ./bin/i2ctest -lwiringPi -lwiringPiDev -lm
run : ./bin/i2ctest
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h> // exit, delay

What is the need of getting such upstarted services on linux ?


I have tested a code working fine on my Raspbery. While much of effort has gone into hardware debugging and getting the ports to work as expected, It still is a challenge to run this program evrytime I have to showcase things to people.Fo each instance I have to connect the hardware along with the peripherals and then carefull issue commands to start the desired program

  1. Logistics of the peripherals is cumbersome
  2. Peripherals sdo consume more amperage

Would it not be good if there was a way th program upstarts with the machine itself ?

Or one up - wait for me in suspension to get started and sensing.

@kneerunjun
kneerunjun / index.html
Last active December 14, 2019 20:03
search-bar custom control
<!DOCTYPE html>
<html>
<head>
<script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script data-require="angular.js@1.4.7" data-semver="1.4.7" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<link data-require="bootstrap@*" data-semver="3.3.5" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<!--this is what is needed to include when you want to access the search bar-->
<script src="http://vpunplepun2-01:8082/searchbar/searchbar.js"></script>
<link rel="stylesheet" href="http://vpunplepun2-01:8082/searchbar/searchbar.css">
</head>
dpkg -l | grep -i docker
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock

go get any intended version


Whilst writing your own GO libraries, we GoPhers have a sound understanding of the packages and GO modules. but somehow when making our own libraries we tend to miss out on a small detail that can limit your versioning on git. I have put this up just so that you can benefit from my experience / exploration of solutions on the internet.

Lets see the problem first hand and then I bring out the solution/tweak.

We are writing this small uni-file library (for brevity sake Im assuming we have this small library)

go mod init github.com/kneerunjun/mylog
@kneerunjun
kneerunjun / data.go
Last active January 9, 2023 07:07
This demonstrates typical pitfalls when you make a datamodel in Go and expect it work smoothly with mgo or mongo-driver, but it does not.
package data
import(
"gopkg.in/mgo.v2/bson"
)
type User struct {
ID bson.ObjectId `bson:"_id"`
Name string `bson:"name"`
Email string `bson:"email"`
}
// for seeding purposes, testing environmen
"todohighlight.keywords": [
{
"text": "NOTE:",
"color": "#ecf0f1",
"backgroundColor": "#16a085",
"overviewRulerColor": "grey",
"isWholeLine": false
},
{
"text": "IMP:",
@kneerunjun
kneerunjun / basicconcurr.go
Last active September 22, 2023 23:49
Interview tidbits
package main
/* For a given number say N, 2 threads (coroutines) namely foo thread, bar thread each are capable of printing "foo" and "bar"
Purpose of this program though is to print "foobar" for n times
*/
import (
"fmt"
"sync"
)
const (