Skip to content

Instantly share code, notes, and snippets.

View maks's full-sized avatar

Maksim Lin maks

  • Manichord
  • Australia
View GitHub Profile
@maks
maks / submit.md
Created September 6, 2020 07:43 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@maks
maks / nine-slice-example.dart
Created July 1, 2020 05:39
example for 9-slice in Flutter article
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'package:flutter/material.dart';
final Color primaryColor = Colors.orange;
final TargetPlatform platform = TargetPlatform.android;
void main() {
@maks
maks / main.dart
Created June 23, 2020 22:23
Flutter Day
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(FlagCircle());
}
class FlagCircle extends StatefulWidget {
@override
@maks
maks / container_color_finder.dart
Created February 18, 2020 00:00
Flutter widget test "Container by Colour" finder
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
class ContainerByColorFinder extends MatchFinder {
ContainerByColorFinder(this.color, {bool skipOffstage = true})
: super(skipOffstage: skipOffstage);
final Color color;
@override
@maks
maks / pre-push
Last active October 22, 2020 10:41 — forked from miquelbeltran/pre-push
Flutter pre-push hook that runs analyze and test
#!/bin/sh
# To use add to `.git/hooks/`
# Should be named `pre-push`
# Make executable with `chmod +x`
# ref: https://gist.github.com/maks/edb25da8706cb04f45ebfdd278d91791
# run Flutter analyze + test
flutter analyze
if [ $? -ne 0 ]; then
echo 'cannot push: Flutter analyze failed'
@maks
maks / foo.txt
Created December 20, 2019 04:22
test
‎‎​
@maks
maks / main.dart
Created December 10, 2019 05:37
dart extensions in dartpad
enum DROID { R2D2, C3PO }
Expando<bool> _hasDSPlans = Expando<bool>();
extension REBELS on DROID {
bool get hasDSPlans => _hasDSPlans[this];
set givePlans(v) => _hasDSPlans[this] = v;
}
@maks
maks / connection_check.dart
Last active August 6, 2019 22:57
Flutter Widget that reacts to connectivity state
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
class ConnectivityCheck extends StatelessWidget {
final Widget child;
ConnectivityCheck({@required this.child});
@override
Widget build(BuildContext context) {
@maks
maks / mkgif.sh
Last active May 3, 2019 01:50
make GIFs out of videos
#!/bin/sh
# args: start-time length video-file
# ref: https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/
ffmpeg -ss $1 -t $2 -i $3 -filter_complex "[0:v] palettegen" /tmp/palette.png
ffmpeg -ss $1 -t $2 -i $3 -i /tmp/palette.png -filter_complex "[0:v][1:v] paletteuse" $3.gif
@maks
maks / AndroidManifest.xml
Created April 4, 2019 07:38 — forked from erkattak/AndroidManifest.xml
Android Application Setup for use with Charles Proxy
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">