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 / 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:
@eggfly
eggfly / FlutterEmbedderGLFW.cc
Created December 31, 2021 06:47 — forked from chinmaygarde/FlutterEmbedderGLFW.cc
Flutter Embedder API Example (GLFW with OpenGL)
#include <assert.h>
#include <chrono>
#include <embedder.h>
#include <glfw3.h>
#include <iostream>
static_assert(FLUTTER_ENGINE_VERSION == 1, "");
static const size_t kInitialWindowWidth = 800;
@eggfly
eggfly / global-gitignore.md
Created December 5, 2021 12:36 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@eggfly
eggfly / read_guid.ino
Created September 28, 2021 03:49 — forked from ksasao/read_guid.ino
Read GUID of LGT8F328P
void setup() {
Serial.begin(9600);
delay(1000);
// read GUID of LGT8F328P
// https://www.avrfreaks.net/sites/default/files/forum_attachments/LGT8F88P%20LGT8F168P%20LGT8F328P%20translated.pdf
// if you want to read other device's unique id, use ArduinoUniqueID
// https://www.arduinolibraries.info/libraries/arduino-unique-id
#ifdef _LGT8F328P_SPEC_H_
char buf[10];
@eggfly
eggfly / LibraryLoaderHelper.java
Created August 11, 2021 08:10 — forked from NLMartian/LibraryLoaderHelper.java
The class provides helper functions to extract native libraries from APK, and load libraries from there.
package org.chromium.base.library_loader;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@eggfly
eggfly / DartVMOptions.txt
Created January 15, 2021 09:48 — forked from azenla/DartVMOptions.txt
Dart VM Options
[kaendfinger@localhost Dart]$ dart --help -v
Usage: dart [<vm-flags>] <dart-script-file> [<dart-options>]
Executes the Dart script passed as <dart-script-file>.
Supported options:
--checked or -c
Insert runtime type checks and enable assertions (checked mode).
--help or -h
Display this message (add -v or --verbose for information about