Skip to content

Instantly share code, notes, and snippets.

@Telewa
Telewa / android_hybrid_appium.py
Last active June 4, 2016 10:55
This is code in python to test android hybrid applications using appium/selenium. The device in context is android 5.0 emulator.
"""
This is code in python to test android hybrid applications using appium/selenium
The device in context is android 5.0 emulator.
Preconditions:
Install python appium client: pip install Appium-Python-Client source: https://github.com/appium/python-client
Install appium: npm install -g [email protected]
Install selenium: pip install -U selenium
On your terminal, run appium: appium
import java.util.*;
/**
* Check if a string has balanced braces, brackets and curly brackets
*
* Key Note: Use a stack data structure. Only pop when the stack top == current item in the string, else
* push
*
* @author emmanuel
*/
class Solution {
@Telewa
Telewa / TreeSort.kt
Created April 17, 2020 19:54
Insert items to a binary tree in kotlin
package com.emma.recursion
import kotlin.test.assertEquals
/**
* Insert items to a binary tree
*
* The side effect is, if the tree is printed with an inorder traversal, the items are sorted in asc order
*
* Worst complexity: n * log(n) (balanced)
@Telewa
Telewa / Timer.kt
Last active April 18, 2020 00:34
Neatly show duration of a function execution in kotlin
package com.emma.recursion
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit.*
/**
* How to neatly show duration of a function execution in kotlin
*/
fun timer(f: () -> Unit) {
@Telewa
Telewa / async_download_many_files.py
Last active November 25, 2022 22:17
Download many files using wget and python
import asyncio
from itertools import islice
from typing import List, Callable
def chunk(arr_range, arr_size):
arr_range = iter(arr_range)
return iter(lambda: tuple(islice(arr_range, arr_size)), ())