Skip to content

Instantly share code, notes, and snippets.

View nschwermann's full-sized avatar
:shipit:

Nathan Schwermann nschwermann

:shipit:
View GitHub Profile
@nschwermann
nschwermann / .bash_profile
Last active December 14, 2015 19:19 — forked from jimothyGator/.bash_profile
Display current Git branch and root directory in Mac OS X Terminal title bar.
# Add to .bash_profile
cd () {
builtin cd "$@"
update_title
}
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
#!/usr/bin/python
'''
Copyright 2009, The Android Open Source Project
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
@nschwermann
nschwermann / .bashrc
Last active December 15, 2015 01:09
Helper functions for adb. Offers a selection menu for multiple devices and makes logcat filtering easier.
#add to your .bash_profile / .bashrc
adbd () {
adb -s $(get_device) "$@"
}
function get_device() {
local devices=$(adb devices | grep device$)
if [ $(wc -l <<< "$devices") -eq 1 ]; then
awk {'print $1'} <<< "$devices"
@nschwermann
nschwermann / manifest.json
Created April 8, 2013 00:43
Chrome plugin to hide reddit sidebar when window is too small.
{
"name" : "Hide Reddit Sidebar",
"version" : "1.1",
"manifest_version" : 2,
"description" : "hides the sidebar when the media is too small",
"content_scripts" : [
{
@nschwermann
nschwermann / README.md
Created May 16, 2013 18:03
Solarized IntelliJ Theme

This tweaks the darcula IntelliJ theme to better match the solarized color scheme found here https://github.com/jkaving/intellij-colors-solarized

To enable, after installing the color scheme linked above set your theme to darcula.

Preferences -> Appearance -> Theme -> Darcula

Exit IntelliJ then add the tweaked darcula properties file to the idea.jar file with the following command

jar -ufv idea.jar com/intellij/ide/ui/laf/darcula/darcula.properties 
@nschwermann
nschwermann / gist:5632785
Created May 23, 2013 04:44
refresh media player on android when new music added to device but not showing up
adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard/music
/*
* Copyright (C) 2014 Chris Banes
*
* 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
@nschwermann
nschwermann / mobile-AndroidManifest.xml
Created June 30, 2014 02:58
Android Wearable Message API example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="schwiz.net.weartest" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
/*
* Copyright 2014 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
/**
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable).
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while
* the alpha values are derived from the source's grayscaled RGB values. The effect is that
* you can see through darker parts of the source bitmap, while lighter parts show up as
* the given color. The 'invert' argument inverts the computation of alpha values, and looks
* best when the given color is a dark.
*/
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) {
int width = src.getIntrinsicWidth();