Skip to content

Instantly share code, notes, and snippets.

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

Kenta IDA ciniml

🏠
Working from home
View GitHub Profile
@ciniml
ciniml / EnumeratePackages.cs
Created February 15, 2018 17:00
Enumerate Packages using PackageManager UWP API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Management.Deployment;
namespace EnumeratePackages
@ciniml
ciniml / EnumerateBleDevices.cs
Created March 2, 2018 15:01
EnumerateBleDevices
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Management.Deployment;
using Windows.Devices;
@ciniml
ciniml / MainWindow.xaml
Last active May 19, 2018 11:31
TabControl ItemsSource
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<TabControl ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=TabItems}">
@ciniml
ciniml / ReadWriteVolume.psm1
Last active November 2, 2018 20:03
Read Write Volume on Windows
function Copy-Stream([System.IO.Stream] $destination, [System.IO.Stream] $source, [long] $bytesToTransfer) {
$buffer = New-Object -Type byte[] -ArgumentList (1024*1024*10)
for ($totalBytesTransferred = [long]0; $totalBytesTransferred -lt $bytesToTransfer; ) {
$bytesToRead = [System.Math]::Min([long]$buffer.Length, [long]($bytesToTransfer - $totalBytesTransferred))
$bytesRead = $source.Read($buffer, 0, [int]$bytesToRead)
if ($bytesRead -eq 0)
{
break;
}
$destination.Write($buffer, 0, $bytesRead);
@ciniml
ciniml / main.c
Created August 7, 2018 18:06
PSRAM Test for M5STACK FIRE
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
@ciniml
ciniml / BasicOTA_task.ino
Created December 9, 2018 15:42
ESP32 OTA handling on another task
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <FreeRTOS/FreeRTOS.h>
const char* ssid = "....";
const char* password = "......";
static void OTATask(void* params)
@ciniml
ciniml / bootstrap.py
Last active December 10, 2018 22:22
MicroPython with FTP server initial bootstrap before configuring Wi-Fi
"""
Setup development environment
"""
import time
import network
import machine
import gc
try:
@ciniml
ciniml / firmware.json
Created February 13, 2019 01:20
M5Burner custom firmware.json
[
{
"name": "M5Stack WiSUN",
"version": "v0.1",
"path": "WiSUN",
"commands": [
"--chip esp32 --port %port --baud %baud --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 %PATH/bootloader.bin 0xf000 %PATH/phy_init_data.bin 0x10000 %PATH/MicroPython.bin 0x8000 %PATH/partitions_mpy.bin 0x1D0000 %PATH/spiffs_image.img"
]
}
]
@ciniml
ciniml / Program.cs
Created February 24, 2019 05:07
Enumerate network device ID
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
@ciniml
ciniml / lib.rs
Last active May 14, 2019 20:02
ESP32 Rust Hello World
#![no_std]
#![feature(lang_items, core_intrinsics)]
use core::intrinsics;
use core::panic::PanicInfo;
use core::alloc::{GlobalAlloc, Layout};
use core::fmt;
use core::fmt::Write;
extern {
fn malloc(size: usize) -> *mut u8;