Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View TheLittleNaruto's full-sized avatar
🎯
Focusing

TheLittleNaruto TheLittleNaruto

🎯
Focusing
View GitHub Profile
@year_api_blueprint.route('/all')
@app.app_context()
@cache.cached(timeout=500, key_prefix="years")
# @requires_login - this need to be public
def get_all_years():
data = Database.find("years", {})
if data is not None:
return jsonify([year for year in data])
$ adb logcat ActivityManager:S LocationManager:S *:V
$ adb logcat -s ActivityManager:V
$ adb logcat > log_to_be_shared.txt
$ adb shell setprop log.tag.MainActivity DEBUG
$ adb logcat -s MainActivity:V
05–13 22:54:51.539 2885 11072 I MainActivity: MainActivity=> onCreate()
$ adb logcat -s *:V #Verbose filter
$ adb logcat -s *:D #Debug filter
$ adb logcat -s *:I #Info filter
$ adb logcat -s *:W #Warning filter
$ adb logcat -s *:E #Error filter
$adb devices
List of devices attached
192.168.1.5:5555 device
$ adb tcpip 5555
$ adb connect <Mobile Device IP Address>:5555
# Example:
$ adb connect 192.168.1.5:5555
@TheLittleNaruto
TheLittleNaruto / MainActivity.kt
Created May 13, 2020 17:19
Example on Logging for Medium article blog on Logging and debugging
class MainActivity : AppCompatActivity() {
companion object {
val TAG = MainActivity::class.java.simpleName
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "$TAG=> onCreate()")
}
@TheLittleNaruto
TheLittleNaruto / deletion_of_keys_in_dict_correctly.py
Created February 5, 2020 07:00
Comprehension in python dict or list
list_ = list(range(6))
for idx, val in enumerate(list_):
print(idx, val)
if idx%2: #we think we wrote code that deletes every item at odd indices
del list_[idx]
print(list_)
#compare to