Skip to content

Instantly share code, notes, and snippets.

View paulproteus's full-sized avatar

Asheesh Laroia paulproteus

View GitHub Profile
@paulproteus
paulproteus / backup.sh
Last active June 21, 2020 07:17
backup a volume
#!/bin/bash
set -eou pipefail
blockdev="$1"
name="$2"
TMP="$(mktemp -d /tmp/$(date -I).$2.XXXXXXXXXX )"
FILELIST="$TMP"/"$name".filelist.txt
# Make the blockdev available in /tmp/name
@paulproteus
paulproteus / Performance notes.md
Last active June 30, 2020 02:29
Performance notes for BeeWare/Android/Python

Current performance worries

  • Unpacking stdlib is very slow. See "things that look promising" below.

  • There's a somewhat sad trade-off between disk I/O being slow on one hand, and bytecode-compiling PYCs being slow on the other.

Things I tried that look promising:

  • If you put the Python *.so modules in the jniLibs directory, then you can add it to PYTHONPATH, ignore PYTHONHOME, and import the libs straight from jnilibs-land. Not bad.
@paulproteus
paulproteus / MainActivity.kt
Created July 12, 2020 03:02
Android/Kotlin activity with Password input
package org.asheesh.bottomnavigationactivity
import android.os.Bundle
import android.text.InputType
import android.text.method.PasswordTransformationMethod
import android.view.Gravity
import android.view.View
import android.widget.EditText
import android.widget.RelativeLayout
import android.widget.TextView
@paulproteus
paulproteus / macOS setup.md
Last active July 20, 2020 23:20
macOS setup
  • homebrew -- install via https://brew.sh/ , skip if multi-user
  • Hammerspoon ShiftIt - if multi-user, use other user's Hammerspoon but add the shiftit spoon
hs.loadSpoon("ShiftIt")
spoon.ShiftIt:bindHotkeys({
  left = {{ 'cmd' }, 'left' },
  right = {{ 'cmd' }, 'right' },
  maximum = {{ 'cmd' }, 'up' }
})
@paulproteus
paulproteus / IntelliJ customization.md
Created July 20, 2020 23:08
IntelliJ customization

huh

@paulproteus
paulproteus / MainActivity.java
Last active August 3, 2020 04:47
Swipe refresh app
/*
* Copyright 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@paulproteus
paulproteus / crash.txt
Last active August 9, 2020 19:08
AltTab crash
Process: AltTab [56075]
Path: /Applications/AltTab.app/Contents/MacOS/AltTab
Identifier: com.lwouis.alt-tab-macos
Version: 4.17.2 (4.17.2)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: AltTab [56075]
User ID: 503
Date/Time: 2020-08-08 19:24:25.294 -0700
diff --git a/src/android/toga_android/window.py b/src/android/toga_android/window.py
index 5dd58700..6de00309 100644
--- a/src/android/toga_android/window.py
+++ b/src/android/toga_android/window.py
@@ -1,4 +1,5 @@
from . import dialogs
+from .widgets.base import _get_activity
class AndroidViewport:
@paulproteus
paulproteus / README.md
Created April 14, 2021 04:43
Image scratchpad

Image scratchpad

TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
{
int actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
Log.e(TAG, "HI action bar " + actionBarHeight);
}