Skip to content

Instantly share code, notes, and snippets.

Avatar

Clark Scheff 0xD34D

  • Cyanogen, Inc
  • Seattle, WA
View GitHub Profile
@0xD34D
0xD34D / generate_comic_book.py
Last active Jan 9, 2019
Generate .cbz comic books from readcomics.tv
View generate_comic_book.py
#!/usr/bin/env python3
from lxml import html
import os
import requests
import shutil
import sys
from urllib import request
from zipfile import ZipFile
AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'
@0xD34D
0xD34D / battery_meter_demo.sh
Created Aug 16, 2016
battery meter demo for CM
View battery_meter_demo.sh
#!/bin/bash
adb shell 'dumpsys batterymanager unplug;settings --cm put system status_bar_battery_style 0;sleep 0.5;for i in $(seq 100 -1 16);do dumpsys batterymanager set level $i;sleep 0.05;done;for i in $(seq 16 100);do dumpsys batterymanager set level $i;sleep 0.05;done;settings --cm put system status_bar_battery_style 5;sleep 0.5;for i in $(seq 100 -1 16);do dumpsys batterymanager set level $i;sleep 0.05;done;for i in $(seq 16 100);do dumpsys batterymanager set level $i;sleep 0.05;done;settings --cm put system status_bar_battery_style 2;sleep 1;for i in $(seq 100 -1 16);do dumpsys batterymanager set level $i;sleep 0.05;done;for i in $(seq 16 100);do dumpsys batterymanager set level $i;sleep 0.05;done;dumpsys batterymanager reset'
@0xD34D
0xD34D / MotionDetectorTest.cpp
Last active Aug 29, 2015
Program for testing a PIR module on the Intel Edison
View MotionDetectorTest.cpp
/*
* Author: Clark Scheff <clark@scheffsblend.com>
* Copyright (c) 2015 Scheff's Blend
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
View gist:f60140415acb8d9af85e
function wordwrap( str, width, brk, cut ) {
brk = brk || '\n';
width = width || 75;
cut = cut || false;
if (!str) { return str; }
var regex = '.{1,' +width+ '}(\\s|$)' + (cut ? '|.{' +width+ '}|.+$' : '|\\S+?(\\s|$)');
matches = str.match( new RegExp(regex, 'g') );
View gist:7000383
#!/bin/bash
EXPECTED_ARGS=1
E_BADARGS=42
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage `basename $0` project_name"
exit $E_BADARGS
fi
@0xD34D
0xD34D / mass_review.py
Created Aug 29, 2013
A python script for conveniently reviewing all open changes in a gerrit project
View mass_review.py
#!/bin/sh
""":"
exec python $0 ${1+"$@"}
"""
# mass review all open commits for a project.
# you will need to specify extra arguments like --code-review, --verified, --submit
#
# The following example will +1 and verify all commits for android_frameworks_base:
# mass_review.py android_frameworks_base --code-review 1 --verified 1
@0xD34D
0xD34D / mass_gerrit_pick.py
Last active Sep 27, 2019
A simple python script to mass pick open changes from gerrit in order based on dependencies.
View mass_gerrit_pick.py
#!/bin/sh
""":"
exec python $0 ${1+"$@"}
"""
# Author: Clark Scheff
#
# Picks all open commits for a given project in the correct
# order based on their dependencies. There is plenty of
# room for improvments but this does work as intended.
#
@0xD34D
0xD34D / ListenerStatusObserver.java
Last active Sep 11, 2017
Listen for when your app is allowed or denied to listen for notifications
View ListenerStatusObserver.java
/**
* This is just a simple ContentObserver class used to listen for
* changes to the list of enabled notification listeners.
* You'll need to create an instance of this class and call observe()
* to listen for changes and unobserve() when you no longer need it.
*/
class ListenerStatusObserver extends ContentObserver {
/**
* Note: Settings.Secure.ENABLED_NOTIFICATION_LISTENERS is hidden from
* the public API so you'll want to replace it with the actual string