Skip to content

Instantly share code, notes, and snippets.

View netdur's full-sized avatar

adel boussaken netdur

View GitHub Profile
private var ids = ArrayList<Long>()
fun getIds(results : Any) : ArrayList<Long> {
var ids = ArrayList<Long>()
for (result in results) {
ids.add(result.id)
}
return ids
}
@netdur
netdur / example.java
Last active August 22, 2017 01:55
android enroll
// bitmap is a photo take from camera, assets or gallery,
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 92, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
String b64 = Base64.encodeToString(byteArray, Base64.DEFAULT);
JSONObject json = new JSONObject();
try {
json.put("img0", b64);
// repeat as necessary, at least 5
@netdur
netdur / index.html
Created July 17, 2023 15:49
GZIP for text similarity
<!DOCTYPE html>
<html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.0.3/pako.min.js"></script>
<script>
// Training set
const trainingSet = [
["How can I create a new project?", "To create a new project, go to the dashboard and click on 'New Project'. Then, fill out the details and click 'Save'."],
["How can I invite team members to my project?", "To invite team members to your project, open the project and click on 'Invite Members'. Enter their email addresses and click 'Send Invites'."],
["Can I assign tasks to team members?", "Yes, you can assign tasks to team members. To do this, create a new task and select a team member from the 'Assign To' dropdown."],