Skip to content

Instantly share code, notes, and snippets.

Artem Sheremet dotdoom

Block or report user

Report or block dotdoom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dotdoom
dotdoom / main.dart
Created Mar 15, 2019
Future, async and scheduleMicrotask
View main.dart
import 'dart:async';
Future<void> b(value) async {
await Future.delayed(Duration(seconds: 0));
// OR: remove the line ABOVE for fun effect.
print('b(${value})');
}
Future<void> a(value) async {
print('a(${value})');
@dotdoom
dotdoom / main.dart
Created Dec 25, 2018
Default initializer vs constructor
View main.dart
class A {
String value;
A(this.value) { print(value); }
String toString() => value;
}
class B {
A a = A('Default');
B();
@dotdoom
dotdoom / main.dart
Created Dec 7, 2018
URI schemes for sending emails (iOS)
View main.dart
import 'dart:core';
void main() {
final commonOptions = {
'subject': 'test',
'body': 'foobar',
};
print(Uri(scheme: 'mailto', path: 'mail@example.com', queryParameters: commonOptions));
@dotdoom
dotdoom / flutter-firebase-order-by-child.dart
Created Jul 15, 2018
Demo of FirebaseDatabase orderByChild with Flutter
View flutter-firebase-order-by-child.dart
import 'package:flutter/material.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/foundation.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
const subpath = 'flutter-firebase-order-by-child';
MyApp() {
@dotdoom
dotdoom / set-chrome-remote-desktop-pin.py
Created Mar 22, 2018
Forgot PIN for Linux Remote Desktop, but still have SSH access? Here's a solution. Remember to backup all config files!
View set-chrome-remote-desktop-pin.py
#!/usr/bin/env python
# Portions Copyright Chromium Project.
import base64
import hashlib
import hmac
import json
import os
import sys
View wait-for-play-services-boot.yml
- emulator -avd test -no-window:
background: true
- circle-android wait-for-boot
# Wait until there's no log spam for some time -- means all Google Play Services have booted.
- >
while ! cmp /tmp/android.log /tmp/android-previous.log; do
mv /tmp/android.log /tmp/android-previous.log
sleep 20
# Compare the last few lines of logcat
adb logcat -t 25 >/tmp/android.log
@dotdoom
dotdoom / adbtcpipd
Last active Jul 31, 2016
A "daemon" constantly trying to enable ADB tcpip on any connected device
View adbtcpipd
#!/usr/bin/env bash
sleep 5
if /sbin/ifconfig usb0 &>/dev/null; then
# usb0 is present - we are in slave mode, this script won't work.
exit
fi
led() {
@dotdoom
dotdoom / verify.go
Last active Jul 11, 2016
Verify Google-issued OAuth2 token in Go
View verify.go
package main
import (
"fmt"
"log"
"net/http"
"google.golang.org/api/oauth2/v2"
)
@dotdoom
dotdoom / i2c.ino
Created Jun 1, 2016
An example of doing an i2c slave with Arduino
View i2c.ino
#define I2CAddress 0x42
void setup() {
Wire.begin(I2CAddress);
// Remember to keep those handlers as time-critical as possible:
// no interrupts will be happening while these are running.
// Also the other end of i2c communication might just
// give up waiting. So keep the logic in loop() and let i2c
// handlers only operate on ready data.
Wire.onReceive(i2cReceive);
@dotdoom
dotdoom / zvv2kml.py
Created Mar 24, 2016
ZVV Tarifzonen KML (Google Maps)
View zvv2kml.py
#!/usr/bin/env python
# Fetch ZVV Tarifzonen map in SVG and convert to KML.
# You can save the output and import into Google Maps.
# Use at your own risk. The API used is not publicly disclosed,
# improper use may lead to lawsuits.
import sys
import urllib2
import xml.etree.ElementTree as ET
You can’t perform that action at this time.