Skip to content

Instantly share code, notes, and snippets.

@simonliu009
simonliu009 / yunfile_downloader
Last active January 7, 2019 13:59
Python: A python script #python #yunfile
#!/usr/bin/env python
# encoding: utf-8
"""
@version: 0.3
@author: endoffiht
@file: yunfile_downloader.py
@time: 15/6/29 18:06
"""
@simonliu009
simonliu009 / user_main.c
Last active January 7, 2019 13:59 — forked from 0x6e/user_main.c
ESP8266 Espressif RTC Example #ESP8266 #RTC
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
os_timer_t rtc_test_t;
#define RTC_MAGIC 0x55aaaa55
typedef struct {
uint64 timeAcc;
uint32 magic;
@simonliu009
simonliu009 / esp8266_pubsubclient.ino
Last active January 7, 2019 14:00 — forked from igrr/esp8266_pubsubclient.ino
Arduino:PubSubClient sample for ESP8266 Arduino #MQTT #Arduino
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
const char* ssid = ".................";
const char* password = "................";
char* topic = "esp8266_arduino_out";
char* server = "iot.eclipse.org";
@simonliu009
simonliu009 / hosts
Last active January 7, 2019 14:01 — forked from alswl/hosts
hosts for OpenWRT, for disable AD in xiaomi TV #hosts #xiaomiTV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com
@simonliu009
simonliu009 / main.py
Created July 20, 2019 13:11 — forked from cloverstd/main.py
Handle file upload by Tornado and Nginx Upload Module
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.web
import tornado.log
import tornado.httpserver
from tornado.options import define, options
import logging
import tornado.gen
@simonliu009
simonliu009 / ESP32_wifi_dns.c
Created July 28, 2019 06:45 — forked from MakerAsia/ESP32_wifi_dns.c
ESP32 (ESP-IDF) WiFi connect and resolve DNS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "lwip/inet.h"
#include "lwip/ip4_addr.h"
#include "lwip/dns.h"
@simonliu009
simonliu009 / gist:a66fc2cbdde10d3999872e5efc0da306
Created September 23, 2019 09:32 — forked from youjunjer/gist:b20f63fcf909862c7943dd955583916e
ESP32-CAM Stream server, auto takepic and OTA
//Change Tools/Partition/Scheme to Minimal SPIFFS (Large APPS with OTA)
//IR sensor set at GPIO13
//Must Insert SD card
#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
@simonliu009
simonliu009 / Tornado webserver MJPEG streamer
Created March 26, 2020 17:26 — forked from mstaflex/Tornado webserver MJPEG streamer
Python Tornado webserver that streams JPEGs (in img/) as MJPEG-Stream using asynchronous timed callbacks (yields), being able to handly many different streams at the same time
import tornado.ioloop
import tornado.web
import gen
import time
import os
import tornado
file_list = os.listdir("img")
counter = 0
/*
* Multiplexed SSD1306 Demo
* Copyright © 2018-01-02 tobozo
*
* https://github.com/tobozo
* https://twitter.com/tobozotagada
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the “Software”), to deal in
* the Software without restriction, including without limitation the rights to
@simonliu009
simonliu009 / aprintf
Created July 21, 2020 15:43 — forked from EleotleCram/aprintf
Simple arduino formatted printf
int aprintf(char *str, ...) {
int i, j, count = 0;
va_list argv;
va_start(argv, str);
for(i = 0, j = 0; str[i] != '\0'; i++) {
if (str[i] == '%') {
count++;
Serial.write(reinterpret_cast<const uint8_t*>(str+j), i-j);