Skip to content

Instantly share code, notes, and snippets.

View tshirtman's full-sized avatar

Gabriel Pettier tshirtman

View GitHub Profile
@christopherperry
christopherperry / adb+
Created July 30, 2012 16:12
A bash script that let's you issue adb commands to multiple devices at once
#!/bin/bash
# Script adb+
# Usage
# You can run any command adb provides on all your currently connected devices
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command>
#
# Examples
# ./adb+ version
# ./adb+ install apidemo.apk
# ./adb+ uninstall com.example.android.apis
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@tshirtman
tshirtman / Ground_(front_layer).png
Created October 10, 2012 22:37
This gist show how to build a scrolling and repeating background with kivy
Ground_(front_layer).png
@tshirtman
tshirtman / graphs.kv
Created November 2, 2012 22:46
commented "camember" diagram in kv
#:kivy 1.4.1
# import Image from core and calls it CoreImage
#:import CoreImage kivy.core.image.Image
#:import Animation kivy.animation.Animation
# create a FloatLayout as root widget
FloatLayout:
# load the kivy icon in "tex" property
@tito
tito / async.py
Last active December 14, 2015 16:38
You don't like callback programming? Use asynchronous!
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.clock import Clock
from kivy.network.urlrequest import UrlRequest
class _async_generator(object):
_calls = []
def __init__(self, func, args, callback):
@tshirtman
tshirtman / text_vertical.py
Created August 13, 2013 16:21
Show how to use either a Scatter or the Rotate instruction to make a widget (here, a Label), rotate around its center, still being correctly centered
from kivy.app import App
from kivy.properties import NumericProperty
from kivy.lang import Builder
from kivy.clock import Clock
kv = """
BoxLayout:
Widget:
Scatter:
center: self.parent.center
@tshirtman
tshirtman / test_rounded.py
Created September 6, 2013 15:44
Rounded rectangle implementation, this is a widget, should probably be converted to a canvas instruction
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ListProperty
from math import sin, cos, pi
kv = '''
BoxLayout:
FloatLayout:
RoundedBox:
def verify_sign(public_key_loc, signature, data):
'''
Verifies with a public key from whom the data came that it was indeed
signed by their private key
param: public_key_loc Path to public key
param: signature String signature to be verified
return: Boolean. True if the signature is valid; False otherwise.
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
@tshirtman
tshirtman / dndm.py
Created November 2, 2013 19:55
Drag'n drop example between a gridlayout and a floatlayout, using magnet for nicer animations
from kivy.app import App
from kivy.garden.magnet import Magnet
from kivy.uix.image import Image
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.clock import Clock
from os import listdir
IMAGEDIR = '/usr/share/icons/hicolor/32x32/apps/'
@tito
tito / bluetooth.py
Created November 12, 2013 15:28
Bluetooth example on Android using Python / Pyjnius
'''
Bluetooth/Pyjnius example
=========================
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
Connect your device to your phone, via the bluetooth menu. After the
pairing is done, you'll be able to use it in the app.