Skip to content

Instantly share code, notes, and snippets.

View thealmikey's full-sized avatar
🎯
Focusing

Michael Gikaru thealmikey

🎯
Focusing
View GitHub Profile
@thealmikey
thealmikey / 0_reuse_code.js
Created March 26, 2016 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
package com.biznet
import android.app.Activity
import android.os.Bundle
import android.support.v7.widget.{LinearLayoutManager, RecyclerView}
import android.util.Log
import android.view.{LayoutInflater, View, ViewGroup}
import android.widget.TextView
import okhttp3.MultipartBody
import retrofit2.converter.gson.GsonConverterFactory
@thealmikey
thealmikey / AudioCall.kt
Created February 21, 2019 06:38
Audio Call Android
package com.almikey.jiplace.ui.call
import android.content.Context
import android.os.Bundle
import android.os.PersistableBundle
import android.util.Log
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.almikey.jiplace.R
import com.google.firebase.auth.FirebaseAuth
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
}
group 'almikey'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
import org.zeromq.ZMQ
fun main() {
val context = ZMQ.context(1)
val socket = context.socket(ZMQ.REP)
}
while (true) {
val rawRequest = socket.recv(0)
...
}
var rawReply = plainReply.toByteArray()
rawReply[rawReply.size - 1] = 0
val cleanRequest = String(rawRequest, 0, rawRequest.size - 1)
println("Request received : $cleanRequest")
fun main() {
val context = ZMQ.context(1)
val socket = context.socket(ZMQ.REP)
println("Starting the server...")
socket.bind("tcp://*:5897")
while (true) {
val rawRequest = socket.recv(0)
val cleanRequest = String(rawRequest, 0, rawRequest.size - 1)
var plainReply = "World "
var rawReply = plainReply.toByteArray()