Skip to content

Instantly share code, notes, and snippets.

View programmer131's full-sized avatar

Furkha programmer131

  • Islamabad, Pakistan
View GitHub Profile
@pudelosha
pudelosha / PlantMoistureSensor.ino
Last active March 14, 2023 12:06
Arduino ESP8266 WiFi MySQL database connection with INSERT SQL command
//#include <DHT.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#define sensorPin1 0
//#define sensorPin2 D2
//#define typeDHT DHT11
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active November 2, 2024 15:03
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@divayprakash
divayprakash / arduino.ino
Created June 23, 2016 08:33
Remove whitespace (" ","\t","\v","\f","\r","\n") from String in Arduino
//REMOVE WHITESPACES FROM STRING IN ARDUINO
String message = "\n\tThis is one messed-up string \r\n";
message.trim();
/*
trim()
Description : Get a version of the String with any leading and trailing whitespace removed.
As of 1.0, trim() modifies the string in place rather than returning a new one.
Syntax : string.trim()
@igrr
igrr / ESP8266httpsUpdate.ino
Last active October 30, 2022 14:18
ESP8266 ota over HTTPS
/*
OTA update over HTTPS
As an example, we download and install ESP8266Basic firmware from github.
Requires latest git version of the core (November 17, 2015)
Created by Ivan Grokhotkov, 2015.
This example is in public domain.
*/
@bmccormack
bmccormack / movingAvg.c
Created March 31, 2015 01:05
Moving average example in C
#include <stdio.h>
int movingAvg(int *ptrArrNumbers, long *ptrSum, int pos, int len, int nextNum)
{
//Subtract the oldest number from the prev sum, add the new number
*ptrSum = *ptrSum - ptrArrNumbers[pos] + nextNum;
//Assign the nextNum to the position in the array
ptrArrNumbers[pos] = nextNum;
//return the average
return *ptrSum / len;
@paulkaplan
paulkaplan / colorTempToRGB.js
Last active March 4, 2024 10:29
Color Temperature to RGB
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work,
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)
function colorTemperatureToRGB(kelvin){
var temp = kelvin / 100;
@mike-zhang
mike-zhang / tcpServer1.py
Created September 29, 2012 09:45
a simple tcp server (python code)
#! /usr/bin/python
# a simple tcp server
import socket,os
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', 12345))
sock.listen(5)
while True:
connection,address = sock.accept()
buf = connection.recv(1024)
print buf