Skip to content

Instantly share code, notes, and snippets.

View gabrc52's full-sized avatar

Gabriel Rodríguez gabrc52

View GitHub Profile
@gabrc52
gabrc52 / __init__.py
Created August 25, 2023 16:31
Synapse: send welcome message
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from twisted.web.resource import Resource
from twisted.web.server import Request
from synapse.module_api import ModuleApi
from synapse.module_api.errors import ConfigError
@dataclass_json
@dataclass
@gabrc52
gabrc52 / ideviceforward
Created June 7, 2022 03:39
Forward iOS device from host to guest (OSX-KVM)
#!/bin/bash
# Debug
set -o xtrace
GUEST_IP=192.168.122.221
HOST_IP=192.168.122.1
# Wipe the current usbfluxd, usbmuxd, and socat:
sudo killall usbfluxd
@gabrc52
gabrc52 / range.dart
Created January 19, 2019 20:31
Python-like range function in Dart
Iterable<int> range(int start, [int stop, int increment]) sync* {
if (increment == null) {
increment = 1;
}
if (stop == null) {
stop = start;
start = 0;
}
@gabrc52
gabrc52 / ios.diff
Last active October 26, 2022 05:56
Allows Flutter to list and debug iOS devices on non-Macs. Requires Flutter 1.12.13+hotfix.9 because the Flutter team switched to Apple-specific tools. See https://medium.com/flutter-community/developing-and-debugging-flutter-apps-for-ios-without-a-mac-8d362a8ec667
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 9544a18f7..d72e28bd4 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'dart:io';
+
@gabrc52
gabrc52 / vscoder
Last active June 7, 2022 03:39
NOTE: THIS GIST IS OUTDATED AS FLUTTER NOW SUPPORTS `flutter run` ON DESKTOP ///////// A simple way of running/reloading a Flutter app on Linux with VS Code using flutter-desktop-embedding (place files in `flutter-desktop-embedding/example/linux`)
#!/bin/bash
project_location=$(pwd)
pushd "$(dirname "$0")" # It expects to be placed in flutter-desktop-embedding/example/linux
mkdir $project_location/.vscode
\cp launch.json $project_location/.vscode/launch.json -f # From https://github.com/google/flutter-desktop-embedding/blob/master/Debugging.md , backslash was added because my distro aliases cp to cp -i
ln -T -s -f $project_location ../flutter_app
pkill flutter
make && \
out/flutter_embedder_example &
popd