Windows 10 ทำให้ แท้

Windows 10 Pro Key กลาง VK7JG-NPHTM-C97JM-9MPGT-3V66T

ต้องไป Activate อีกที

ตัวอย่างการ Activate
slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr /skms kms8.msguides.com
slmgr /ato

ไปดูที่ system จะกลายเป็น Windows is Activated

Router user password 2019

ZTE F600 F660

TOT

admin:admin

admin:tot

user:user

superadmin:astratot

 

HUAWEI HG8245A

TOT   user:telecomadmin  pass : admintelecom

mysql ubuntu ไม่มี root password แต่จะเข้าดูข้อมูล

ที่ root linux สั่งหยุด service mysql

/etc/init.d/mysql stop

mysqld –skip-grant-tables –skip-networking & หรือ mysqld_safe –skip-grant-tables &

mysql -u root

ระบบจะเข้ามาที่

mysql>

แสดงฐานข้อมูลทั้งหมดใช้

show databases;

เลือกใช้ฐานข้อมูล

use dbname; เช่นฐานข้อมูลชื่อ datax  ก็ใช้ use datax;

เมือ่เลือกฐานได้แล้ว จะตารางทั้งหมด พิมพ์

show tables;

เช่น

mysql> show tables;
+——————–+
| Tables_in_datax |
+——————–+
| name                      |
| address1                |
| address2               |
| postcode               |
| tel                           |
| email                      |
| users                      |
+——————–+
7 rows in set (0.00 sec)

ถ้าแสดงข้อมูลทั้งหมดใน table นั้นใช้

SELECT * FROM [table name];

เช่น SELECT * FROM name;

ถ้าแสดงโครงสร้าง ใน table นั้นว่ามี field ชื่ออะไรบ้างให้ใช้

show columns from [table name];

ถ้าแสดงข้อมูลมากเกินดูไม่ทันให้พิมพ์

pager less

เลิก กด +-e หรือกด q

 

 

 

 

lost ubuntu 10 root password recovery mode not work

ubuntu ลืมรหัสผ่าน พอ boot มา recovery mode แล้ว จะติดให้ใส่ password

Give root password for maintenance (or type Control-D to continue)

ทำการแก้โดย reboot ใหม่

แล้ว กด shift ค้างยาวๆ ก่อน boot menu หลังกดจะปรากฎ รายการ

เลือกรายการแรก กด e เพื่อแก้ไข  จะแสดงคำสั่งมา ซึ่งยกตัวอย่างเป็น

insmod ext2

set root='(hd0,1)’
search –no-floppy –fs-uuid –set 896c7bf8-d2c1-4844-aa49-95e840b77995\519
echo ‘ Load Linux 2.6.32xxx’
linux /vmlinuz-2.6.32xxx root=UUID=896c7bf8-d2c1-4844-aa49-95e840b77995 ro rootdelay=45
initrd /boot/initrd.img-2.6.32xxx

ในรูป มองหาคำสั่ง linux  แล้ว ลบ ro rootdelay=45 ออก (บางอันเป็น ro recovery nomodeset) เพิ่มตอนท้ายเป็น  rw init=/bin/bash

กลายเป็น

linux /vmlinuz-2.6.32xxx root=UUID=896c7bf8-d2c1-4844-aa49-95e840b77995 rw init=/bin/bash

จากนั้นกด Ctrol-X  เพื่อ boot จะออก มา ที่ root ได้

Arduino Nano +DHT22

#include “DHT.h”
#define DHTPIN 2 // what pin we’re connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE, 6);

void setup() {
Serial.begin(9600);
Serial.println(“DHTxx test!”);

dht.begin();
}

void loop() {
// Wait a few seconds between measurements.
delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius
float t = dht.readTemperature();
// Read temperature as Fahrenheit
float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}

// Compute heat index
// Must send in temp in Fahrenheit!
float hi = dht.computeHeatIndex(f, h);

Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print(“Temperature: “);
Serial.print(t);
Serial.print(” *C “);
Serial.print(f);
Serial.print(” *F\t”);
Serial.print(“Heat index: “);
Serial.print(hi);
Serial.println(” *F”);

}

output

DHTxx test!
Humidity: 93.10 % Temperature: 29.90 *C 85.82 *F Heat index: 106.62 *F
Humidity: 93.20 % Temperature: 29.90 *C 85.82 *F Heat index: 106.68 *F
Humidity: 93.30 % Temperature: 29.90 *C 85.82 *F Heat index: 106.74 *F
Humidity: 93.30 % Temperature: 29.90 *C 85.82 *F Heat index: 106.74 *F
Humidity: 93.20 % Temperature: 29.90 *C 85.82 *F Heat index: 106.68 *F

remark ตัว DHT22 ที่ทดสอบ ไม่ค่อยดีนัก

credit:http://arduino-er.blogspot.com/2015/05/arduino-nano-dht11-temperature-humidity.html

nodmcu V3 (Lolin) DHT11 with DeepSleep

การหลับ Deepsleep จะเป็นหน่วย microsecond

#include <ESP8266WiFi.h>
#include “DHT.h”
//deep sleep  wire GPIO16 (D0) to RST Pin
#define DHTPIN D4 // ขา Out ของ Sensor ต่อเข้าขา D4 ของ Esp8266
#define DHTTYPE DHT11 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin();
Serial.begin(9600);
Serial.println(“Humidity and temperature\n\n”);
delay(700);
}

void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print(“Current humidity = “);
Serial.print(h);
Serial.print(“% “);
Serial.print(“temperature = “);
Serial.print(t);
Serial.println(“C “);
//ESP.deepSleep(30e6); // Deep sleep mode for 30 seconds
//ESP.deepSleep(60e6); // Deep sleep mode for 60 seconds
ESP.deepSleep(300e6); // Deep sleep mode for (~5 min) 300 seconds
delay(800);
}

credit:https://roboindia.com/tutorials/DHT11-NodeMCU-arduino

 

nodmcu V3 (Lolin) DHT11 #1

nodmcu-dht11-d4

#include “DHT.h”

#define DHTPIN D4 // ขา Out ของ Sensor ต่อเข้าขา D4 ของ Esp8266
#define DHTTYPE DHT11 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin();
Serial.begin(9600);
Serial.println(“Humidity and temperature\n\n”);
delay(700);
}

void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print(“Current humidity = “);
Serial.print(h);
Serial.print(“% “);
Serial.print(“temperature = “);
Serial.print(t);
Serial.println(“C “);
delay(800);
}

nodmcu-dht11-d4-output

credit:https://roboindia.com/tutorials/DHT11-NodeMCU-arduino

 

nodemcu 0.9 am2305 ds18b20 thingspeak

// www.arduinesp.com
//
// Plot DTH11 data on thingspeak.com using an ESP8266
// April 11 2015
// Author: Jeroen Beemster
// Website: www.arduinesp.com
// ใช้กับ กล่อง วัดอุณหภูมิที่บ้าน
// 20-3-2017 ใช้งานครั้งแรก DHT22
// 19-5-2017 เพิ่ม DS18B20
// 18-12-2017 ซ่อมครั้งที่ 1 เปลี่ยน DHT22 เป็น AM2305
// 26-2-2018 เปลี่ยน accesspoint ใหม่ ตั้งรหัสใหม่ เปลี่ยน thingspeak acc ใหม่
#include <DHT.h>
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include “ThingSpeak.h”

// replace with your channel’s thingspeak API key,
unsigned long myChannelNumber = xxxxxx;
const char * myWriteAPIKey = “xxxxxxxxxxxxxx”;

const char* ssid = “SMART_xxx”;
const char* password = “xxxxxxxxxxx”;

#define DHTPIN1 D1 // d0 dht22 ext
// #define DHTPIN2 D2 // d1 dht22 mushroom
DHT dht1(DHTPIN1,DHT22,15);
// DHT dht2(DHTPIN2,DHT22,15);
#define sensorPin D2 // Data wire is plugged into pin D3 on NodeMCU
OneWire oneWire(sensorPin); // Setup the oneWire Sensor
DallasTemperature DS18B20(&oneWire); // Pass reference to Dallas Temperature.
WiFiClient client;

ADC_MODE(ADC_VCC);
// int vcc;
void setup() {
Serial.begin(115200);
delay(10);
dht1.begin();
//dht2.begin();
WiFi.begin(ssid, password);

Serial.println();
Serial.println();
Serial.print(“Connecting to “);
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
Serial.println(“”);
Serial.println(“WiFi connected”);
Serial.println(“IP address: “);
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
}

void loop() {

float h1 = dht1.readHumidity();
float t1 = dht1.readTemperature();
float vcc = 0.00f;
vcc = ESP.getVcc()/1024.00f;
// uint32_t vcc = ESP.getVcc()/1000.0;
DS18B20.requestTemperatures();
float t2 = DS18B20.getTempCByIndex(0);
//if (isnan(h1) || isnan(t1) ||isnan(h2) || isnan(t2)) {
if (isnan(h1) || isnan(t1) ) {
Serial.println(“Failed to read from EXT DHT sensor 1 !”);
//return;
t1=0;
h1=0;
}
else if (isnan(t2) ) {
Serial.println(“Failed to read from DS18B20 mushroom sensor 2 !”);
//return;
t2=0;
//h2=0;
}
Serial.print(“Temperature 1: “);
Serial.print(t1);
Serial.print(” C Humidity 1: “);
Serial.print(h1);
Serial.print(” % Voltage : “);
Serial.print(vcc);
Serial.print(” V MushRoom Temperature 2: “);
Serial.print(t2);
Serial.println(” C”);
//Serial.print(” C MushRoom Humidity 2: “);
//Serial.print(h2);
//Serial.println(“% send to Thingspeak”);

ThingSpeak.setField(1,t1);
ThingSpeak.setField(2,h1);
ThingSpeak.setField(3,vcc);
ThingSpeak.setField(4,t2);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
Serial.println(“Waiting”);
delay(20000);
// ThingSpeak will only accept updates every 15 seconds.
// delay 1 minitue delay 1000=1sec

client.stop();

Serial.println(“Wifi Disconnect”);
WiFi.disconnect();
//delay(60000);
delay(100);
//โดย 1,000,000 microseconds = 1 second)
Serial.println(“”);
Serial.println(“Deep Sleep 5 min”);
// deep sleep 1 min
//ESP.deepSleep(60 * 1000000, WAKE_RF_DEFAULT);
//deep sleep 5 min
ESP.deepSleep(360 * 1000000, WAKE_RF_DEFAULT);
//ESP.deepSleep(5*60 * 1000000);
//node.dsleep(60 * 1000000);
delay(500); // wait for deep sleep to happen
}