Skip to content

Instantly share code, notes, and snippets.

View sanfx's full-sized avatar
🎯
Focusing

Sanjeev Kumar sanfx

🎯
Focusing
  • London
  • 14:35 (UTC +01:00)
View GitHub Profile
@sanfx
sanfx / custom_ui_docked.py
Last active July 25, 2017 07:26 — forked from fredrikaverpil/custom_ui_docked.py
Create custom PySide GUI and dock it into Nuke UI
import PySide.QtCore as QtCore
import PySide.QtGui as QtGui
from nukescripts import panels
## https://docs.thefoundry.co.uk/nuke/70/pythonreference/nukescripts.panels-module.html
class PanelTest(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setLayout(QtGui.QVBoxLayout())
@sanfx
sanfx / docker commands
Created June 10, 2017 14:11
useful docker commands
# will forcibly remove the docker container by stopping it and then build new from current location
docker rm -f `docker ps -q -a` ; docker build -t armin:v1 .
# will run the newly built container and then enter container's bash shell of container.
docker exec -it `docker run -itd armin:v1` bash
@sanfx
sanfx / backup_script.py
Created June 9, 2017 18:08 — forked from jvkersch/backup_script.py
Python wrapper around to rsync to facilitate backup
#!/usr/bin/env python
"""
A simple wrapper around rsync for backup.
Usage: create a text file with on each line a resource that you wish to
backup. Paths should be relative to the user's home directory. Entries
starting with '#' are ignored, as are blank lines. Call this script via
python backup_script.py -i [backup_files.txt] [rsync_target_folder]
@sanfx
sanfx / profileToGraph.py
Created June 9, 2017 17:53
profile to graph on pdf with text on vector graphics
@contextlib.contextmanager
def profileYo(toolName, showGraph=False):
profiler = cProfile.Profile()
profiler.enable()
profilePath = "/tmp/%s_Profile" % toolName
dotPath = "/tmp/gprof.dot"
pdfPath = "/tmp/%s_Profile.pdf" % toolName
yield

ESP8266 Web Server to storing ap config to EEPROM.

Original by chriscook8 from esp8266.com I just modified to use ESP8266WebServer library for easy to handle the http request.

This is sample code not yet complete.

Todo

  • when Wifi connected need to close the softAP.
@sanfx
sanfx / apache2.conf
Created February 2, 2017 17:16 — forked from deletosh/apache2.conf
default Apache2 conf file
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@sanfx
sanfx / stringStream.cpp
Created January 27, 2017 12:24
using string stream in cpp and returning from subroutines
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
using namespace std;
char* getSql() {
float outdoorTempInC = 15;
int outoorHumidity = 23;
@sanfx
sanfx / JSONPSensorServer.ino
Created December 28, 2016 14:40 — forked from sfentress/JSONPSensorServer.ino
Arduino Server for JSON-P pin values
/*
Web Server returning data as JSON-P, adapted from http://arduino.cc/en/Tutorial/WebServer
A simple web server that returns the value of the analog input pins as
a JSON-P object, using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13 (standard configuration)
* Analog inputs attached to pins A0 through A5 (optional)
* Example of reading LM35 on pin A0:
@sanfx
sanfx / sparkfun.htm
Created December 28, 2016 09:40
pulling the last value from sparkfun and displaying it on google gauge
<html>
<head>
<title>Google Gauge Example displayData from sparkfun</title>
<style type="text/css">
body { background-color: #ddd; }
#container { height: 100%; width: 100%; display: table; }
#inner { vertical-align: middle; display: table-cell; }
#gauge_div { width: 120px; margin: 0 auto; }
</style>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>
@sanfx
sanfx / thingspeak.htm
Created December 28, 2016 09:36
pull data from thingspeak.com and display it on google gauge
<html>
<head>
<title>Google Gauge - ThingSpeak Example</title>
<style type="text/css">
body { background-color: #ddd; }
#container { height: 100%; width: 100%; display: table; }
#inner { vertical-align: middle; display: table-cell; }
#gauge_div { width: 120px; margin: 0 auto; }
</style>