This file contains 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
package /* Package Name */ | |
import android.content.Context | |
import android.graphics.* | |
import android.util.AttributeSet | |
import android.widget.TextView | |
class TextViewChip(context: Context, attrs: AttributeSet) : TextView(context, attrs) { | |
private val path = Path() |
This file contains 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
package sample.helloworld | |
import platform.posix.* | |
/* | |
Reference of C code: | |
--------------------- | |
int main() | |
{ |
This file contains 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
package sample | |
import glibresources.* | |
import kotlinx.cinterop.* | |
import libgtk3.* | |
import libgtk3.G_APPLICATION_FLAGS_NONE | |
This file contains 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
val fd = open(file_path, O_RDONLY) | |
val buffer_size = 2 | |
val buffer = nativeHeap.allocArray<ByteVar>(buffer_size) | |
var bytesRead: ssize_t = 0 | |
while (bytesRead < 19) { | |
val ret = read(fd, buffer + bytesRead, (buffer_size).convert()) |
This file contains 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 kotlinx.coroutines.* | |
/** | |
* You can edit, run, and share this code. | |
* play.kotlinlang.org | |
*/ | |
This file contains 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
// http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]] | |
// | |
// Usage: | |
// ---------------------------------------------- | |
// val url = URL("http://abc.com:80/smith/home.html?key=value&key2=value2") | |
// println("${url.protocol} -- ${url.host} -- ${url.port} -- ${url.path} -- ${url.query}") | |
// --------------------------------------------- | |
class URL(url: String){ | |
var protocol = "" |
This file contains 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
enum class Type { STATUS, HEADER, BODY } | |
fun readK(fd: Int, chunk: Int, block: (ByteArray) -> Unit) { | |
var type = Type.STATUS | |
var contentLength = 0L | |
var spaceCount = 0 | |
var method = ""; var path = ""; var protocol = "" | |
var key = ""; var value = "" |
This file contains 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
/** | |
* ------------ | |
* JSON Parser | |
* ----------- | |
* | |
* Fully Parse: JSON(Jsontxt).parse() | |
* Get Single Object: JSON(Jsontxt).getObject("ggg") | |
* From Hashmap or List to JSON String: JsonObj.toJSONString() | |
* | |
* |
This file contains 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 kotlinx.cinterop.* | |
import platform.posix.* | |
// IrFile | |
// ------------------------------------------------------ | |
data class PsiFile internal constructor(val path: String, var name: String = path.substringAfterLast('/')) | |
val PsiFile.open get() = open(path, O_RDONLY) | |
val PsiFile.size get() = nativeHeap.alloc<stat>().apply { stat(path, ptr) }.st_size |
This file contains 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
# Install build tools | |
sudo apt-get install python3 python3-pip python3-setuptools python3-wheel ninja-build meson | |
#gnome-shell | |
echo "downloading gnome-shell..." | |
curl -o gnome-shell-3.35.91.tar.xz https://ftp.gnome.org/pub/GNOME/sources/gnome-shell/3.35/gnome-shell-3.35.91.tar.xz | |
tar -xz gnome-shell-3.35.91.tar.xz | |
echo "install gnome-shell dependencies..." | |
sudo apt-get install pkg-config cmake libecal2.0-dev libgirepository1.0-dev |
OlderNewer