Skip to content

Instantly share code, notes, and snippets.

@jsonfry
jsonfry / extend.sh
Last active April 11, 2017 08:20 — forked from bitjockey42/extend.sh
Extend non-HiDPI external display to left of HiDPI internal display
#!/bin/sh
# extend non-HiDPI external display on DP* left of a HiDPI internal display eDP*
# see also https://wiki.archlinux.org/index.php/HiDPI
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319
# Original version from: https://gist.github.com/wvengen/178642bbc8236c1bdb67
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
package co.blah.ui.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.provider.Settings;
import android.util.AttributeSet;
import android.widget.ProgressBar;
@jsonfry
jsonfry / adbss
Created August 15, 2016 10:13
quick way to get a screenshot from an Android device onto my Mac
#! /bin/bash
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
adb shell screencap -p /sdcard/$timestamp.png
adb pull /sdcard/$timestamp.png ~/Desktop/$timestamp.png
adb shell rm /sdcard/$timestamp.png
@jsonfry
jsonfry / Install Docker.md
Last active October 14, 2020 09:24
Docker Help

Install Docker

  1. Install Docker For Mac if you haven't already

  2. Start the Docker For Mac App

  3. Open a Terminal window - (iTerm2 is nicer than Mac's built in one)

  4. Login to Docker Hub if you haven't already. You'll need to create an account on their website if you don't already have one.

@jsonfry
jsonfry / Remote ADB.md
Last active September 8, 2023 19:45
Connect to adb over a network. Useful for running jenkins in 'the cloud', but testing on real devices locally.

Connect your devices to a pi that has been configured like below.

Pi Setup

Download raspbian etc, go through normal setup.

Setup networking

This will let you find your pi locally using it's name, e.g. ping davepi.local

sudo apt-get update

sudo apt-get install avahi-daemon

@jsonfry
jsonfry / my-redirect
Created March 21, 2015 18:08
Ubuntu: Redirect Local Ports
# Run these commands, and use the files below for the content
sudo nano /etc/network/if-up.d/my-redirect
chmod +x /etc/network/if-up.d/my-redirect
nano /etc/network/if-down.d/my-redirect-clearer
chmod +x /etc/network/if-down.d/my-redirect-clearer
@jsonfry
jsonfry / springpad_to_txt.rb
Created March 17, 2013 00:10
A little ruby script to convert springpad's (http://springpad.com/) html export file into a series of plain text files, in folders corresponding to their note books! To get your html export, in Springpad go to settings>services and choose create backup, wait a few minutes, and then download the backup. Place this ruby file in your unzipped expor…
require 'rexml/document'
require 'time'
require 'fileutils'
OUTPUT_FOLDER = 'notes'
WORKING_HTML_FILEPATH = 'index.html.working'
def get_foldername(element)
begin
return get_contents_element_from_span(element, "actual-name, 'workbooks'").get_text().to_s()