Skip to content

Instantly share code, notes, and snippets.

View pandalion98's full-sized avatar
🏠
Working from home

pandalion98

🏠
Working from home
View GitHub Profile
@r0xsh
r0xsh / read.java
Created April 12, 2019 07:46
Android: Read file contents from Uri
public static byte[] readUri(Context context, Uri uri) throws IOException {
ParcelFileDescriptor pdf = context.getContentResolver().openFileDescriptor(uri, "r");
assert pdf != null;
assert pdf.getStatSize() <= Integer.MAX_VALUE;
byte[] data = new byte[(int) pdf.getStatSize()];
FileDescriptor fd = pdf.getFileDescriptor();
FileInputStream fileStream = new FileInputStream(fd);
fileStream.read(data);
@viegelinsch
viegelinsch / etc-kbd-config.patch
Created February 21, 2015 15:30
patch for /etc/kbd/config to prevent Raspberry Pi from sleeping
--- /etc/kbd/config 2015-02-21 16:24:59.653062112 +0100
+++ /etc/kbd/config.new 2015-02-21 16:24:28.554492138 +0100
@@ -38,7 +38,8 @@
# screen blanking timeout. monitor remains on, but the screen is cleared to
# range: 0-60 min (0==never) kernels I've looked at default to 10 minutes.
# (see linux/drivers/char/console.c)
-BLANK_TIME=30
+#BLANK_TIME=30
+BLANK_TIME=0
@gdamjan
gdamjan / README.md
Last active April 16, 2024 04:57
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements