Skip to content

Instantly share code, notes, and snippets.

@linuxmotion
linuxmotion / serchFor
Created September 25, 2011 01:52
Search for text within a file
#!/bin/bash
if [ $1 == '-g' ]
then
grep $3 `find . -name $2`
else
find . -name $2 -exec grep $3 '{}' \;
#!/bin/bash
BACKUP='.backup'
mkdir $BACKUP
unoconv --listener
unoconv -f odt *.doc
@linuxmotion
linuxmotion / MotionEventlogdumper.java
Created September 20, 2011 03:31
Android MotionEvent dumper
public class EventDump
{
/** Show an event in the LogCat view, for debugging */
private static void dumpEvent(MotionEvent event) {
String names[] = { "DOWN" , "UP" , "MOVE" , "CANCEL" , "OUTSIDE" ,
"POINTER_DOWN" , "POINTER_UP" , "7?" , "8?" , "9?" };
StringBuilder sb = new StringBuilder();
int action = event.getAction();
int actionCode = action & MotionEvent.ACTION_MASK;
sb.append("event ACTION_" ).append(names[actionCode]);
@linuxmotion
linuxmotion / bashrc_branch_patch
Created August 18, 2011 05:30
Bash branch in CLI
# snip .bashrc
function bash_git_branch
{
git branch 2> /dev/null | grep \* | python -c "print '['+raw_input()[2:]+']'" 2> /dev/null
}
#snip .bashrc
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(bash_git_branch)\$ '
#snip the rest
@linuxmotion
linuxmotion / gist:876752
Created March 18, 2011 20:13
Lockscreen Mods for OMFGB
/*
* Copyright (C) 2008 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
*
* Unless required by applicable law or agreed to in writing, software