Skip to content

Instantly share code, notes, and snippets.

View febritecno's full-sized avatar
🏠
Working from home

Febrian Dwi Putra febritecno

🏠
Working from home
  • linkedin.com/in/febrian-dwi-putra
  • Bojonegoro, indonesia
  • 12:45 (UTC +07:00)
View GitHub Profile
@febritecno
febritecno / alist.md
Last active September 10, 2020 04:49 — forked from tuannvm/cheatsheet.md
golang cheetsheet all by example #go #cheatsheet #golang
@febritecno
febritecno / database.rules.json
Created August 26, 2020 04:52 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@febritecno
febritecno / firestore_service.dart
Created August 3, 2020 05:02 — forked from lohanidamodar/firestore_service.dart
Flutter firestore generic helper class
import 'package:cloud_firestore/cloud_firestore.dart';
class DatabaseService<T> {
final String collection;
final Firestore _db = Firestore.instance;
final T Function(String, Map<String,dynamic>) fromDS;
final Map<String,dynamic> Function(T) toMap;
DatabaseService(this.collection, {this.fromDS,this.toMap});
Future<T> getSingle(String id) async {
var snap = await _db.collection(collection).document(id).get();
if(!snap.exists) return null;
import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
class PreferenceManager {
static PreferenceManager sharedInstance = PreferenceManager();
//<<<<<<<<<<<<<<<<<<<<<<<< All Setters <<<<<<<<<<<<<<<<<<<<<<
Future<bool> putString(String key, String value) async {
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.7 + ESP8266 Community Edition v 2.1.0-rc1 and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ArduinoJson library 5.0.7 https://github.com/bblanchon/ArduinoJson
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- subscribes to the topic "/IoTmanager" (waiting "HELLO" messages from mobile device)
- publishes config to the topic "/IoTmanager/config/deviceID/"
Tested with Arduino IDE 1.6.7 + ESP8266 Community Edition v 2.1.0-rc2
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
@febritecno
febritecno / IoTmanager.ino
Created July 21, 2020 13:01 — forked from 4refr0nt/IoTmanager.ino
ESP8266 client for IoT Manager (Android app)
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.
@febritecno
febritecno / ScrapePage.cs
Last active June 22, 2020 13:33 — forked from Legends/ScrapePage.cs
Puppeteer Sharp - Scraping using C# and puppeteer
//document.querySelector("#riwayat > table > tbody > tr:nth-child(1) > td:nth-child(3) > span").textContent [untuk get text DOM]
//https://converter.telerik.com [convert c# to VB (static web language]
// bahasa pemprograman static/AOT/compile bisa di convert. beda dengan bahasa pemprotaman compile sambil running (JIT)
//https://github.com/kblok/netconfar-puppeteer-sharp-demo
private async Task<DtoEst> LoadXXXAsync()
{
// downloads chromium to the local project, needed by Puppeteer Sharp for execution, takes about 2 min!
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
using System;
using System.Threading;
using System.Threading.Tasks;
using PuppeteerSharp;
using System.Collections.Generic;
namespace netDemo
{
public class Program
{