Skip to content

Instantly share code, notes, and snippets.

@roboter
roboter / fastled.cpp
Last active December 12, 2022 17:55
FastLED Example
#include <Arduino.h>
#include <FastLED.h>
#define DATA_PIN 1
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
#define NUM_LEDS 16
CRGB leds[NUM_LEDS];
/* Arduino menu library example
Oct. 2016 Rui Azevedo (ruihfazevedo@gmail.com) www.r-site.net
Digital keypad (3 buttons) using the menu keyIn driver
*/
#include <Arduino.h>
#include <menu.h>
#include <menuIO/serialIn.h>
#include <menuIO/serialOut.h>
@roboter
roboter / mongoose-demo.c
Last active February 13, 2018 18:47
mongooseOS working demo
#include "mgos.h"
#include "mgos_mqtt.h"
static void led_timer_cb(void *arg) {
bool val = mgos_gpio_toggle(mgos_sys_config_get_pins_led());
LOG(LL_INFO, ("%s uptime: %.2lf, RAM: %lu, %lu free", val ? "Tick" : "Tock",
mgos_uptime(), (unsigned long) mgos_get_heap_size(),
(unsigned long) mgos_get_free_heap_size()));
(void) arg;
}
@roboter
roboter / static.ps1
Created January 31, 2018 09:53
Download website with WGET
param([string]$buildFolder)
$jVUNDemo = "$($buildFolder)\jVUNDemo"
$staticSiteParentPath = (get-item $buildFolder).Parent.FullName
$staticSite = "static-site"
$staticSitePath = "$($staticSiteParentPath)\$($staticSite)"
$wgetLogPath = "get.log"
$port = 60345
$servedAt = "http://localhost:$($port)/"
write-host "jVUNDemo location: $jVUNDemo"
public class PrintPos
{
[DllImport("kernel32", SetLastError = true)]
public static extern IntPtr CreateFile(string lpFileName, Int32 dwDesiredAccess, Int32 dwShareMode, IntPtr lpSecurityAttributes, Int32 dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile);
public const Int32 FILE_ATTRIBUTE_NORMAL = 128;//Intializing Port Attributes
public const Int32 INVALID_HANDLE_VALUE = -1;
public const Int32 GENERIC_READ = -2147483648;
public const Int32 GENERIC_WRITE = 1073741824;
public const Int32 CREATE_NEW = 1;
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
<img src="data:image/tiff;base64,SUkqAIoCAACAP+BP8AQWDQeEQmFQuGQ2HQ+IRGJQ+BwSJxeMRmNRuNRWOR+QSGRRSBxN0ScAPiVRsIS0AS0ISOZSKPRIQzcAOCdRswT0AJ+gTOQKaiAAl0cAA+lReayIg08ACCpT+g0KhPSsAAG1sALqvAAi2GmSWR08g1Gp0BPwx+W0ALC4ABqXMABy7AAsXkAAy+QxUX8AM/BXu+lbDAAD4kAJzGABC48AGLJAAX5UAEPMAAV5uGU2Q2a0CCqWuDyp8AAe6nCAwADjXABSbEABTaABj7cAAjdAA770AIrgABLcMAN7jAB/ckAFDmABJc8AKzpAAhdWk0tBdkACzuZ2yU6oVLRWqEITzABW+kAMv2AACe+UysI/MAI/7AA0fkADH+AAaP+ABNwEiB5QK64HgAYcFAAHkGrGgSZNA8TRoQsIity3Ypw0hjHkKAAkRAABJxGAA3RMABTxSADzEIAAtRerSuIPAp5QOABiRwAAdx3B6LPAs8JvIg4UyIuq7x2HaICBJYASWICEE1KIAEdKgAHNK4AE9LQACpLoARpG0cGJHUeImzyQQktKqoMJs2gAEk4Pq+6rN43xVTuABvz1L8DKVBExTJJMzO+z7wzU0iDFBRQADjRoAF3SD/QAg5mUrIwOAADFNAASFOgAOFQIQKtRrkuhr1OhADVUAAr1axbGsSA6ITOj7QTgEkAwGg62n4AA81/TlPJghDdARR9IhRZIABvZgAGVZ6EBNaQAEraoACJbCEDXbbhOIg5eXAy7MoXWk6IjXgAHJdT3Pgu1MIfK5zMQxQJ3qi6TnQACSgzflZ0Jc2
@roboter
roboter / iptocountry.cs
Created August 16, 2017 07:20
IP2Country
using System;
using System.Collections.Generic;
using System.Linq;
using MaxMind.GeoIP2;
using MaxMind.GeoIP2.Responses;
namespace IP2Country
{
/*
Install-Package MaxMind.GeoIP2 -Version 2.8.0
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <FlexiTimer2.h> // use timer for sampling to get even time base for data
// If using software SPI (the default case):
#define OLED_MOSI 9
#define OLED_CLK 10
void Main()
{
var array1=new string[]{
"tea",
"tea",
"act",
"hhpddlnnsjfoyxpci",
"xulkowreuowzxgnhmiqekxhz",
"dnqaurlp",
"aujteqimwfkjoqodgqaxbrkrwykpmuimqtgulojjwtukjiqra",
void Main()
{
var array1=new string[]{
"tea",
"tea",
"act",
"hhpddlnnsjfoyxpci", //hhpddlnnsjfoyxpci
"xulkowreuowzxgnhmiqekxhz",
"dnqaurlp",
"aujteqimwfkjoqodgqaxbrkrwykpmuimqtgulojjwtukjiqra",