Skip to content

Instantly share code, notes, and snippets.

View albertalrisa's full-sized avatar

Albert Richard Sanyoto albertalrisa

View GitHub Profile
@albertalrisa
albertalrisa / handle_keyboard_insets.dart
Created April 26, 2021 05:55
Flutter helper function used to ensure components wrapped will not be covered by the device on-screen keyboard by resizing it. This can be used as alternative to `resizeToAvoidBottomInset` property of Flutter Scaffold components.
Widget handleKeyboardInset(
Widget child, {
bool resizeToAvoidBottomInset = true,
}) {
return LayoutBuilder(builder: (context, constraint) {
var actualInset = 0.0;
if (resizeToAvoidBottomInset) {
final mediaQuery = MediaQuery.of(context);
final viewport = mediaQuery.size.height -
mediaQuery.padding.top -
@albertalrisa
albertalrisa / compress-and-upload-kbfs.sh
Last active April 24, 2021 11:29
A shell script for compressing a directory into a password protected 7z archive and copying it to an output directory. Password is based on SHA256 hash of the provided filename. This script by default uploads to Keybase public folder and returns the public URL of the file.
#! /bin/bash
USERNAME="" # Fill your keybase username here
SALT="" # Input salt to prevent the password from being guessed
read -ep "Input directory to compress: " dirname
read -p "Input filename (without extension): " fname
pass=$(echo -n "$SALT$fname" | openssl dgst -sha256 | sed 's/(stdin)= //g' | tr a-z A-Z)
zipname="$fname.7z"
# Add -mhe to encrypt filenames as well

Keybase proof

I hereby claim:

  • I am albertalrisa on github.
  • I am albertalrisa (https://keybase.io/albertalrisa) on keybase.
  • I have a public key ASBnXTK6zytuWGHP53nIosfM4NMk1a2s2rthZ62aty171wo

To claim this, I am signing this object: