Skip to content

Instantly share code, notes, and snippets.

View eggfly's full-sized avatar
🎯
flutter-hacking

eggfly

🎯
flutter-hacking
  • Beijing
View GitHub Profile
@eggfly
eggfly / MiniMax.ino
Created April 14, 2024 07:28
MiniMax.ino
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
// flash mode 要改dio
// 1. Replace with your network credentials
const char* ssid = " ";
const char* password = " ";
// 2. Replace with your OpenAI API key
@eggfly
eggfly / esp32_lv_test.py
Last active March 14, 2024 15:24
ESP32-MicroPython-LVGL-ILI9341-Test.py
from ili9XXX import ili9341
import lvgl as lv
from machine import Pin, PWM
def init_backlight(brightness):
frequency = 5000
duty_cycle = int(1023 * brightness)
led = PWM(Pin(21), frequency)
led.duty(duty_cycle)
@eggfly
eggfly / mini_mp3_radio_decoder.c
Created July 9, 2023 06:55 — forked from Flix01/mini_mp3_radio_decoder.c
Very basic single-file, plain C, openAL mp3 radio decoder
// gist made after this issue: https://github.com/mackron/dr_libs/issues/142
/*
The license refers to this single file.
Every included or linked library comes with its own license
===============================================================================
Public Domain (www.unlicense.org)
===============================================================================
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
@eggfly
eggfly / main.cpp
Created October 16, 2022 14:44 — forked from fffonion/main.cpp
Read Xiaomi Mijia temperature and humidity sensor 2 (LYWSD03MMC) from ESP32
#include <Arduino.h>
#include <BLEDevice.h>
BLEClient *pClient;
BLEScan *pBLEScan;
#define SCAN_TIME 10 // seconds
bool connected = false;
@eggfly
eggfly / pycurses.py
Created August 23, 2022 03:49 — forked from claymcleod/pycurses.py
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@eggfly
eggfly / main.cc
Created August 10, 2022 08:12
A demo of __builtin_frame_address()
#include <iostream>
void my_stack_trace(int max_depth) {
uintptr_t frame = (uintptr_t) __builtin_frame_address(0);
uintptr_t next;
while (max_depth--) {
next = *(uintptr_t *) frame;
frame = next;
std::cout << (void *) next << std::endl;
}
@eggfly
eggfly / repo-rinse.sh
Created August 9, 2022 06:06 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@eggfly
eggfly / main.dart
Created July 29, 2022 09:25 — forked from nosmirck/main.dart
Async where and examples for List<T>
void main(List<String> arguments) async {
var list = List.generate(10, (i) => i)..addAll(List.generate(10, (i) => i));
//Normal Where
print(list.where(foo).toList());
//Async Where
print((await list.whereAsync(fooAsync)).toList());
//Normal UniqueWhere
print(list.uniqueWhere(foo).toList());
//Async UniqueWhere
print((await list.uniqueWhereAsync(fooAsync)).toList());
@eggfly
eggfly / main.dart
Created July 29, 2022 07:13
flutter refresh data source
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
@eggfly
eggfly / readme.en.md
Created June 15, 2022 06:44 — forked from CombinedEffort/readme.en.md
How to run Windows 11 on ARM in QEMU 6.1 on Apple Silicon Mac

How to run Windows 11 on ARM in QEMU 6.1 on Apple Silicon Mac

  1. Follow the excellent gist here, up to and including step 7 : https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278

  2. I converted my VHDX to qcow2 - I doubt if that's significant, but YMMV:

./qemu-img convert -p -O qcow2 ~/Windows11_InsiderPreview_Client_ARM64_en-us__22454-orig.VHDX Windows11.img
  1. Run qemu with a slightly modified command-line. It may not be the most efficient, but it worked for me: