Skip to content

Instantly share code, notes, and snippets.

View espresso3389's full-sized avatar

Takashi Kawasaki espresso3389

View GitHub Profile
/*
* The MIT License
*
* Further resources on the MIT License
* Copyright 2018 Cuminas Corporation/@espresso3389
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
@espresso3389
espresso3389 / legendOfHeroes.dart
Created June 16, 2019 21:07
Legend of Heroes
import 'package:flutter/material.dart';
/// The class controls every [Hero] widget has it's own name.
/// If the code generates [Hero.tag] by some model derived algorithm,
/// especially in list widgets such as [ListView.builder], the tag may
/// conflict in some case. The class has internal tag list and if same tag
/// is used twice, it does not insert [Hero] in that case.
/// ```dart
/// Widget build(BuildContext context) {
#include <ESP8266WiFi.h> // or WiFi.h for ESP32
#include <WiFiClientSecure.h>
#include <map>
const char* const GOOGLE_APIKEY = "gggggggggggggggggggggggggggggg";
const char* const SLACK_TOKEN = "ssssssssssssssssssssssssssssssssssss";
void setup()
{
pinMode(14,OUTPUT);
@espresso3389
espresso3389 / vscode-disable-gpu.bat
Last active September 16, 2019 10:13
Script to configure VSCode not to use GPU acceleration
@echo off
setlocal enabledelayedexpansion
rem Additional options to append to VSCode launching command lines.
set ADDTIONAL_OPTS=--disable-gpu
rem insiders, exploration, or other for normal version.
set FLAVOR=insiders
rem VSCode, VSCode Insiders, VSCode Exploration,...
@espresso3389
espresso3389 / keychain_init.sh
Created December 1, 2020 14:39
Installing p12 certificate (public-key/private-key combination) to keychain accessible on ssh connection
#!/bin/sh
#
# Install our provisioning certificates on the runner machine
#
# Reference: https://apple.stackexchange.com/a/285320
#
# Set $P12_BASE64 and $P12_PASSWORD before invoking the script
MY_KEYCHAIN="temp.keychain"
@espresso3389
espresso3389 / mobileprovision.sh
Last active December 25, 2020 09:32
Installing provisioning profile
#/bin/sh
#
# Installing provisioning profile
# Set $PROVISIONING_PROFILE_BASE64 and $CERT_SERIAL_NUMBER before invoking the script.
PROVPROF_TMP=$GITHUB_WORKSPACE/tmp.mobileprovision
echo "$PROVISIONING_PROFILE_BASE64" | openssl base64 -d -A -out $PROVPROF_TMP
UUID=`grep UUID -A1 -a $PROVPROF_TMP | grep -io "[-A-Z0-9]\{36\}"`
echo "Provisioning profile UUID: $UUID"

M5Stack Motor Module/Cable

PIN Cable Color RJ12 PIN Description
M+ Black 2 motor +
G Green 4 encoder Vcc (3.3V - 5V)
A Yellow 5 encoder A
B Blue 6 encoder B
V Red 3 encoder GND
1 White 1 motor -
void main() {
print('''Multiline
String
can be
directly embedded on the code!''');
}
@espresso3389
espresso3389 / flutter-ffi-async-nativeport.md
Last active August 12, 2025 01:48
Async messaging between Flutter and C++ using Dart ffi NativePort

C++

  • Copy Dart SDK (${FLUTTER_DIR}/bin/cache/dart-sdk/include) to your project, e.g. ios/Classes/
  • Add your own code like the following fragment
#include "dart_api_dl.h"

// Receives NativePort ID from Flutter code
static Dart_Port_DL dart_port = 0;
@espresso3389
espresso3389 / flutter-#93615.dart
Created November 19, 2021 07:28
Sample repro for flutter #93615
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);