Skip to content

Instantly share code, notes, and snippets.

View LongClipeus's full-sized avatar
:atom:
Focusing

Long Le Van LongClipeus

:atom:
Focusing
View GitHub Profile
[
{
"id": "c154697af277016d452b1bc815f5d1787fa2d694",
"thumbnail": "https://media.guim.co.uk/9fd1d41b23d3831ee8b918930cdd1bdc0c8045e1/0_0_2560_1536/500.jpg",
"title": "There is a wounded pigeon in the garden. Should I intervene?",
"url": "https://www.theguardian.com/lifeandstyle/2022/oct/15/there-is-a-wounded-pigeon-in-the-garden-should-i-intervene",
"words": "795",
"section": "Life and style",
"date": "2022-10-15T05:00:58Z",
"image": "https://media.guim.co.uk/9fd1d41b23d3831ee8b918930cdd1bdc0c8045e1/0_0_2560_1536/1000.jpg",
@LongClipeus
LongClipeus / HashUtils.kt
Last active March 13, 2024 11:54
How to generate checksum hash for a file in Kotlin
import StringUtils.encodeHex
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.security.MessageDigest
object HashUtils {
const val STREAM_BUFFER_LENGTH = 1024
@LongClipeus
LongClipeus / DCT-2D.cpp
Created January 6, 2019 02:50
The Discrete Cosine Transform: DCT-2D
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
#define LEN 8
#define PI 3.141592654
const char *FILEPATH = "document.txt";
@LongClipeus
LongClipeus / Bai_tap.md
Last active May 8, 2023 15:23
Bài tập lập trình cơ bản

Bài 1: viết chương trình "Hello world"

Bài 2: Viết chương trình hiển thị N dòng "Hello world", với N là số nguyên dương nhập vào từ bàn phím

Bài 3: Viết chương trình nhập vào 1 số X bất kỳ và hiển thị số vừa nhập, cho biết số đó là số thập phân, số nguyên âm hay nguyên dương

Bài 4: Viết chương trình tính tổng 3 số thực nhập vào từ bàn phím

Bài 5: Viết chương trình nhập vào 3 số thực và kiểm tra 3 số này có phải là cạnh của một tam giác hay không

@LongClipeus
LongClipeus / FaceMeshConst.kt
Created April 28, 2023 03:52
The face mesh points to the lips in Mediapipe
object FaceMeshConst {
val FACEMESH_UPPER_RIGHT_LIPSS = listOf(
StraightLineFaceMesh(0, 267),
StraightLineFaceMesh(267, 11),
StraightLineFaceMesh(11, 0),
StraightLineFaceMesh(11, 302),
StraightLineFaceMesh(302, 267),
StraightLineFaceMesh(267, 11),
@LongClipeus
LongClipeus / InstallJdk.sh
Last active March 25, 2023 19:00
Install jdk from tar.gz file in Ubuntu
sudo su
#create jvm directory
mkdir /usr/lib/jvm
#uncompress, change to your file name
tar -zxf jdk-8u211-linux-x64.tar.gz -C /usr/lib/jvm
#check if files are there
#ls /usr/lib/jvm
@LongClipeus
LongClipeus / HelloJNI.java
Last active May 14, 2022 16:35
Example JNI/C++ Hello World in Ubuntu
public class HelloJNI {
static {
System.loadLibrary("hello"); // load libhello.so
}
private native void sayHello();
public static void main(String[] args) {
new HelloJNI().sayHello();
}
{
"featuredComics": [
{
"name": "Thánh gióng 1",
"type": "Truyện Cổ Tích",
"listen_count": 100
},
{
"name": "Thánh gióng 2",
"type": "Truyện Cổ Tích",
import android.content.Context
import androidx.annotation.RawRes
import com.tech.melait.common.utils.ResourceUtils.readRawFile
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
suspend fun readRawFile(context: Context, @RawRes res: Int) = withContext(Dispatchers.Default) {
context.resources.readRawFile(res)
}
@LongClipeus
LongClipeus / PermissionUtils.kt
Last active September 25, 2021 07:41
How to know if user has disabled Picture in Picture feature permission?
const val ACTION_PIP_SETTING = "android.settings.PICTURE_IN_PICTURE_SETTINGS"
@RequiresApi(Build.VERSION_CODES.O)
fun AppCompatActivity.hasPictureInPicturePermission(): Boolean {
val appOps = getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
val uid = android.os.Process.myUid()
val mode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
appOps.unsafeCheckOpNoThrow(AppOpsManager.OPSTR_PICTURE_IN_PICTURE, uid, packageName)
} else {
@Suppress("DEPRECATION")