This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.asheesh.fourbuttonsattwohundredpixels | |
import android.R.attr.delay | |
import android.os.Bundle | |
import android.os.Handler | |
import android.view.View | |
import android.widget.AbsoluteLayout | |
import android.widget.Button | |
import android.widget.ScrollView | |
import androidx.appcompat.app.AppCompatActivity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.asheesh.fourbuttonsattwohundredpixels | |
import android.R.attr.delay | |
import android.os.Bundle | |
import android.os.Handler | |
import android.view.View | |
import android.widget.Button | |
import android.widget.RelativeLayout | |
import android.widget.ScrollView | |
import androidx.appcompat.app.AppCompatActivity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.asheesh.fourbuttonsattwohundredpixels | |
import android.os.Bundle | |
import android.os.Handler | |
import android.util.DisplayMetrics | |
import android.view.View | |
import android.widget.Button | |
import android.widget.RelativeLayout | |
import android.widget.ScrollView | |
import androidx.appcompat.app.AppCompatActivity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
My first application | |
""" | |
import toga | |
from toga.constants import RIGHT | |
from toga.style import Pack | |
from toga.style.pack import COLUMN, ROW | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Minor layout bug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.asheesh.fourbuttonsattwohundredpixels | |
import android.database.DataSetObserver | |
import android.util.Log | |
import android.view.View | |
import android.view.ViewGroup | |
import android.widget.SpinnerAdapter | |
import android.widget.TextView | |
class CustomSpinnerAdapter: SpinnerAdapter { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SNIPPET | |
// Create a Spinner | |
val spinner = Spinner(this, Spinner.MODE_DROPDOWN) | |
val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, | |
arrayOf("Option 1", "Option 2", "Option 3")) | |
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) | |
spinner.adapter = adapter | |
spinner.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED) | |
val spinnerParams = RelativeLayout.LayoutParams(spinner.measuredWidth, spinner.measuredHeight) | |
dynamicLayout.addView(spinner, spinnerParams) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
05-16 15:52:01.587 10790 10817 D stdio : Rubicon namespace package not registered! | |
05-16 15:52:02.994 10790 10817 D stdio : Python app launched & stored in Android Activity class | |
05-16 15:52:02.996 10790 10817 D stdio : | |
05-16 15:52:03.097 10790 10817 D stdio : Seems to have a loop for None | |
05-16 15:52:03.097 10790 10817 D stdio : letting it continue anyway | |
05-16 15:52:03.100 10790 10817 D stdio : Would have caught loop in set_value(), but continuing anyway | |
05-16 15:52:03.103 10790 10817 D stdio : Seems to have a loop for None | |
05-16 15:52:03.103 10790 10817 D stdio : letting it continue anyway | |
05-16 15:52:03.103 10790 10817 D stdio : Would have caught loop in set_value(), but continuing anyway | |
05-16 15:52:03.105 10790 10817 D stdio : Seems to have a loop for None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/labbots/google-drive-upload | |
+ patch out some `-f` checks to be `-e` (since `-f` is false on a block device) | |
+ replace `wc -c` with `blockdev --getsize64 $filename` to avoid spending 6 hours on `wc -c` before even uploading | |
+ `cp -a` the block device to /tmp/ with a nice filename, so google-drive-upload uses that as the GDrive filename | |
Wait 6 hours or so. | |
Then figure out the MD5 thing to validate the upload. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero | pv -pterb -s $(blockdev --getsize64 /dev/sdb) | sudo dd bs=4M of=/dev/sdb | |
Thanks to https://serverfault.com/questions/6440/is-there-an-alternative-to-dev-urandom/415962 | |
Note per https://tches.iacr.org/index.php/TCHES/article/view/8392 it may not be as secure as one might dream, but I'm OK with this given my use. | |
This lets me write to the disk at 128MiB/s, which is better than the ~20MiB/s I was getting when doing the naive | |
cat /dev/urandom | pv | sudo dd of=/dev/sdb |