Skip to content

Instantly share code, notes, and snippets.

View mlagerberg's full-sized avatar

Mathijs "Mat" Lagerberg mlagerberg

View GitHub Profile
@mlagerberg
mlagerberg / savegame-sync.bat
Last active September 10, 2017 22:58
[Windows batch script for keeping savegames in sync over Dropbox]
@echo off
set DROPBOX=%HOMEPATH%\Dropbox
cls
echo.
echo This script will create directory junctions between your savegames and Dropbox/Google Drive/Skydrive/Copy/SugarSync/CX/etc,
echo essentially storing your savegames in the cloud.
echo So, make sure you have enough space in your Dropbox account!
echo No Dropbox? Go: http://db.tt/9OTahFS
echo Better yet, use Copy and get many more gigabytes: https://copy.com?r=fxEXmQ
@mlagerberg
mlagerberg / adbtextinput-extended.bat
Last active April 26, 2018 17:47
[Android text input from your PC] #android #adb
@echo off
cls
echo.
echo Enter text and hit enter to send text
echo input to your phone or emulator.
echo Note: having adb in your path is required.
echo.
echo Type /help for a list of available commands,
echo /quit or Ctrl+C to quit.
echo.
@mlagerberg
mlagerberg / btcspark.py
Last active September 10, 2017 22:56
[Bitcoin sparkline in the terminal]
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# btcspark.py
#
# Shows the current value of Bitcoin in Euro, as given by bitcoinaverage.com,
# along with a sparkline of the last 24 hours.
#
# Requires
from __future__ import print_function, unicode_literals
@mlagerberg
mlagerberg / keybase.md
Created September 24, 2014 15:03
keybase.md

Keybase proof

I hereby claim:

  • I am monkeyinmysoup on github.
  • I am mathijs (https://keybase.io/mathijs) on keybase.
  • I have a public key whose fingerprint is 2AB9 E999 4F01 AE06 0690 B9C5 F610 2E8F 6A14 ED37

To claim this, I am signing this object:

@mlagerberg
mlagerberg / AndroidManifest.xml
Last active September 10, 2017 22:56
[Google Now shortcut] Add Android app as a replacement for the Google Now shortcut (swipe up on home button) #android
<activity ... >
<intent-filter>
<action android:name="android.intent.action.ASSIST"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@drawable/ic_assist"
/>
</activity>
@mlagerberg
mlagerberg / rpi-install.sh
Last active September 10, 2017 22:56
[rpi-install.sh] Installs and configures many things useful for a fresh Rasbian install #rpi #bash
#!/bin/bash
############################################################################
#
# Installs and configures many things useful for a fresh Rasbian install.
# All things configured are described in this repo:
# https://github.com/mlagerberg/raspberry-pi-setup
#
# Created by Mathijs Lagerberg, 2015
#
# It does NOT:
@mlagerberg
mlagerberg / backup.sh
Last active September 10, 2017 22:55
[My Pi scripts] #rpi
#!/bin/bash
# ___ CREDITS
# This script is a modification of
# https://github.com/aweijnitz/pi_backup/blob/master/backup.sh
# which started from
# http://raspberrypi.stackexchange.com/questions/5427/can-a-raspberry-pi-be-used-to-create-a-backup-of-itself
# which in turn started from
# http://www.raspberrypi.org/phpBB3/viewtopic.php?p=136912
#
@mlagerberg
mlagerberg / WebFragment.java
Last active August 17, 2018 15:40
[WebFragment] Fragment with WebView, busy indicator, custom user-agent, and correct fallback when offline. SDK 9 and up #android
package com.github.gist.monkeyinmysoup;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.net.ConnectivityManager;
import android.net.Uri;
@mlagerberg
mlagerberg / DottedLine.java
Last active February 20, 2021 11:04
[Vertical dotted line view] #android
package com.pixplicity.gist.ui.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathDashPathEffect;
import android.util.AttributeSet;
@mlagerberg
mlagerberg / backup_rsync.sh
Last active September 10, 2017 22:54
[backup.sh] Bash script, uses rsync to back up directory to another drive and keeps 3 incremental backups #bash #pi
#!/bin/bash
# Runs a backup of /media/hdd/BTSync to /media/backup/,
# incremental, keeping the last 3 versions.
# Sources:
# rsync and hard links: http://www.mikerubel.org/computers/rsync_snapshots/#Rsync
# rsync progress: http://www.cyberciti.biz/faq/show-progress-during-file-transfer/
# human readable time: http://www.daveeddy.com/2014/06/29/human-readable-duration-in-bash/
human() {
local seconds=$1