Skip to content

Instantly share code, notes, and snippets.

View sanfx's full-sized avatar
🎯
Focusing

Sanjeev Kumar sanfx

🎯
Focusing
  • London
  • 02:21 (UTC +01:00)
View GitHub Profile
@sanfx
sanfx / query.sql
Created November 3, 2019 18:21
SQL query used in Grafana to get temperature and humidity form MySQL server and computer dew point and heat index and display in panel.
SELECT
dt_created AS "time",
temp AS "Temperature",
humidity AS "Humidity",
(temp - ((100 - humidity)/5)) AS "Dew Point",
((temp* 1.8) + 32) AS temp_f,
(((-42.379 + 2.04901523*@temp_f + 10.14333127*humidity - .22475541*@temp_f*humidity - .00683783*@temp_f*@temp_f - .05481717*humidity*humidity + .00122874*@temp_f*@temp_f*humidity + .00085282*@temp_f*humidity*humidity - .00000199*@temp_f*@temp_f*humidity*humidity) - 32)*.5556)
AS "Feels Like"
FROM particle_photon
ORDER BY dt_created;
@sanfx
sanfx / TempSensor.h
Created October 26, 2019 18:41 — forked from dmiddlecamp/TempSensor.h
OneWire Temp - Multiple Sensors
#include "application.h"
class TempSensor {
public:
char *id ;
uint8_t rom[8];
float value ;
int updated ;
};
@sanfx
sanfx / tricks.py
Last active May 3, 2019 22:15
callable object class and magic methods __call__, __getitem__
class BaseClass(object):
def __init__(self):
"""Initialise newly created object.
"""
super(BaseClass, self).__init__()
print "Constructor called."
def __call__(self, storage):
"""Implements function call operator.
"""
project
|______init__.py
|____api
| |______init__.py
| |____base
| | |______init__.py
| | |____resources.py
| |____hello
| | |______init__.py
| | |____resources.py
@sanfx
sanfx / vuetify-datepicker.vue
Created July 11, 2018 03:36
single file component vuetify date picket
<template
<v-layout row wrap>
<v-flex xs12 sm6 md4>
<v-menu
ref="menu"
:close-on-content-click="false"
v-model="menu"
:nudge-right="40"
:return-value.sync="date"
lazy
@sanfx
sanfx / devpi.json
Created May 29, 2018 08:42
devpi json result of new index
{
"result": {
"bases": [
"root/pypi"
],
"pypi_whitelist": [],
"volatile": true,
"acl_upload": [
"san"
],
@sanfx
sanfx / devpi-server-article.md
Created May 28, 2018 16:49 — forked from chronossc/devpi-server-article.md
Article/how to about how install devpy-server (not finished yet)

dev-pi install howto

This guide follow instructions in the devpi quickstart server guide. We will install in own user home using virtualenvs, than, will setup a nginx instance. Server used here is Ubuntu Server 12.04 LTS in one virtualbox instance.

Create devpi user

root ~ # useradd -m -U -s /bin/bash devpi
root ~ # passwd devpi
@sanfx
sanfx / vue_component.vue
Created March 11, 2018 03:04
standard template, script, and style sections along with the code example
<template>
<div>
<h3>I'm a Survey Component</h3>
</div>
</template>
<script>
export default {
data() {
return {
@sanfx
sanfx / Galaxy Of Tutorial Torrents
Created September 25, 2017 19:47 — forked from iHassan/Galaxy Of Tutorial Torrents
Ultimate Galaxy Of Tutorial Torrents
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
@sanfx
sanfx / geonames.py
Created July 31, 2017 08:49 — forked from pamelafox/geonames.py
Geonames Python wrapper
import sys
import urllib
import urllib2
import json
import logging
class GeonamesError(Exception):
def __init__(self, status):