This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
It read files from csv file and separates "labels" and "texts" from it. | |
""" | |
import pandas as pd | |
import os | |
import numpy as np | |
import string | |
def run(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# development way | |
if __name__ == '__main__': | |
app.run() | |
## server on http://127.0.0.1:5000/ | |
## (invisible across the network) won't work on other device, other than development machine | |
# suggested way | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', port=5000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
android { | |
compileSdkVersion 26 | |
buildToolsVersion '26.0.2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Attempt to understand RNN | |
url : http://monik.in/a-noobs-guide-to-implementing-rnn-lstm-using-tensorflow/ | |
""" | |
import numpy as np | |
from random import shuffle | |
import tensorflow as tf | |
# makes 20 digits binary values | |
train_input = ['{0:020b}'.format(i) for i in range(2 ** 20)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
// tutorial @ https://www.youtube.com/watch?v=JUOyKSZScW0&index=2&list=PLGLfVvz_LVvReUrWr94U-ZMgjYTQ538nT (bubble sort, binary search) | |
public class SortingAlgo { | |
private int[] arrayVals = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; | |
// print an array | |
private void printArray() { | |
System.out.println("---printing arrays"); | |
for (int i = 0; i < arrayVals.length; i++) { | |
System.out.println(String.format("---value in array at index %d is %d", i, arrayVals[i])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent iTent = new Intent(Intent.ACTION_VIEW); | |
StringBuilder subjectStringBuilder = new StringBuilder(); | |
String appVersionName = "1"; | |
try { | |
appVersionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; | |
} catch (PackageManager.NameNotFoundException e) { | |
e.printStackTrace(); | |
} | |
String deviceName = android.os.Build.MANUFACTURER + Constants.BLANK_SPACE + android.os.Build.MODEL; | |
String androidVersion = "Android " + android.os.Build.VERSION.RELEASE; |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// step 1 - make a fake response interceptor | |
class FakeResponseInterceptor : Interceptor { | |
@Throws(IOException::class) | |
override fun intercept(chain: Interceptor.Chain): Response? { | |
val responseString = "{\n" + | |
"\t\"name\": \"audhil\",\n" + | |
"\t\"occupation\": \"android developer\"\n" + | |
"}" | |
var response: Response? = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun initSwipeToDelete() { | |
ItemTouchHelper(object : ItemTouchHelper.Callback() { | |
// enable the items to swipe to the left or right | |
override fun getMovementFlags(recyclerView: RecyclerView, | |
viewHolder: RecyclerView.ViewHolder): Int = | |
makeMovementFlags(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) | |
override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, | |
target: RecyclerView.ViewHolder): Boolean = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// XML generation by code | |
// based on https://www.schibsted.pl/blog/back-end/readable-xml-kotlin-extensions/ | |
fun XmlSerializer.document(docName: String = "UTF-8", | |
xmlStringWriter: StringWriter = StringWriter(), | |
init: XmlSerializer.() -> Unit): String { | |
startDocument(docName, true) | |
xmlStringWriter.buffer.setLength(0) // refreshing string writer due to reuse | |
setOutput(xmlStringWriter) | |
init() | |
endDocument() |