Skip to content

Instantly share code, notes, and snippets.

View paulproteus's full-sized avatar

Asheesh Laroia paulproteus

View GitHub Profile
@paulproteus
paulproteus / README.md
Last active November 1, 2023 16:39
nsjail within Docker (aarch64)

Overview

This document explains some risks of server-side image processing and explains a technique to make that much safer. I recommend using this technique.

Strategy

For a web app that is running in Docker, it's helpful to delegate work such as image conversion to a subprocess. We can confine subprocesses so they can only access non-sensitive data by using Linux security features while running them in the same Docker container as the full web app. This allows for complete mitigation of security issues in the subprocesses with maximum convenience and minimal slowdown.

Every few years, complex packages like imagemagick have critical security bugs; people find about one issue per month

@paulproteus
paulproteus / README.md
Created October 23, 2022 14:39
tar-data-xfer
tar cf -  --exclude .Trash  --exclude Library/Caches --exclude Library/Cookies --exclude Library/Metadata/CoreSpotlight --exclude Library/PersonalizationPortrait --exclude Library/Safari --exclude Library/Containers --exclude 'Library/Group Containers' --exclude Library/Suggestions . | pv > /dev/null
@paulproteus
paulproteus / images.md
Created April 18, 2021 04:35
Image scratcpad

just images

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);
}
@paulproteus
paulproteus / README.md
Created April 14, 2021 04:43
Image scratchpad

Image scratchpad

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 / 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
@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 / IntelliJ customization.md
Created July 20, 2020 23:08
IntelliJ customization

huh

@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' }
})