Skip to content

Instantly share code, notes, and snippets.

@belsander
belsander / adb_with_reconnect.sh
Last active December 17, 2016 15:52
Script to connect to Android device attached via the network. Reconnects if connection was lost.
#!/bin/bash
#
# adb_with_reconnect.sh: Wrapper around Android Debug Bridge which auto reconnects when network connection has to reestablished (Useful in case of unstable Android device or poor network connection. Also makes use of nmap for an analysis of the Android device, so installation of nmap is recommended
#
# Copyright (C) 2016 Sander Bel
#
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
@belsander
belsander / football-data.co.uk_convert.py
Last active December 17, 2016 15:32
Convert XLS files from http://football-data.co.uk to a more workable CSV format
#!/usr/bin/python
"""football-data.co.uk_convert.py: Convert xslx files to one or more workable csv file(s)
Copyright (C) 2016 Sander Bel
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
dir([object])
# Example
class test_class:
def __init__(self, test_property):
self.__test_property = test_property;
@property
def test_property(self):
return self.__property_value
@test_property.setter
__file__
# Example
$ cat test_script.py
#!/usr/bin/python
print(__file__)
$ python test_script.py
test_script.py
id(object)
# Example
>>> test_dict1 = {"a": 1, "b": 2}
>>> test_dict2 = test_dict1
>>> test_dict3 = dict(test_dict1) # intiliaze a new dictionary based upon test_dict1
>>> test_dict1
{'a': 1, 'b': 2}
>>> test_dict2
{'a': 1, 'b': 2}
isinstance(object, classinfo)
# Example
>>> test_dict = dict()
>>> dict # just showing what is a type object is
<type 'dict'>
>>> isinstance(test_dict, dict)
True
>>> isinstance(test_dict, list)
False
type(object)
# Example
>>> test_dict = dict()
>>> test_int = 0
>>> test_str = ""
>>> test_tuple = tuple()
>>> test_list = list()
>>> type(test_dict)
<type 'dict'>
zip([iterable, ...])
# Example
>>> test_list1 = ["a", "b", "c"]
>>> test_list2 = [1, 2, 3]
>>> zip(test_list1, test_list2)
[('a', 1), ('b', 2), ('c', 3)]
>>> dict(zip(test_list1, test_list2))
{'a': 1, 'c': 3, 'b': 2}
>>> test_list2 = [1, 2, 3, 4]
import dbus
class dbus_parse(object):
__slots__ = ("__dbus_parse_dict", "__parse_dbus_dict", "__parse_dbus_list", "__parse_dbus_tuple", "__parse_dbus_var", "parse_dbus_vars")
def __init__(self):
self.__dbus_parse_dict = { dbus.String: str,
dbus.Int16: int, dbus.Int32: int, dbus.Int64: int,
dbus.UInt16: int, dbus.UInt32: int, dbus.UInt64: int,
dbus.Double: float,
dbus.Boolean: bool,
var = <any valid Python syntax you can place here is an expression>