Skip to content

Instantly share code, notes, and snippets.

View ThanosFisherman's full-sized avatar

Thanos Psaridis ThanosFisherman

View GitHub Profile
#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
exec "$@"
@opnchaudhary
opnchaudhary / force-install
Created February 13, 2020 09:31
Force Install in arch linux
sudo pacman -S npm --overwrite='*'
package hu.akarnokd.kotlin
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.schedulers.Schedulers
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
object RepeatBench {
@JvmStatic
@gabrielemariotti
gabrielemariotti / README.MD
Last active September 24, 2024 09:22
How to use the ShapeableImageView.

The Material Components Library introduced with the 1.2.0-alpha03 the new ShapeableImageView.

In your layout you can use:

 <com.google.android.material.imageview.ShapeableImageView
      android:id="@+id/image_view"
      app:srcCompat="@drawable/..." />

Then in your code apply the ShapeAppearanceModel to define your custom corners:

@PasanBhanu
PasanBhanu / CheckNetwork.java
Last active July 25, 2023 13:28
Check Internet Connection in Android (API Level 29) Using Network Callback
/*
You need to call the below method once. It register the callback and fire it when there is a change in network state.
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application.
*/
// You need to pass the context when creating the class
public CheckNetwork(Context context) {
this.context = context;
}
@983
983 / main.c
Created August 23, 2019 14:13
Draw concave polygon using OpenGL and stencil buffer
// Build on linux:
// sudo apt install freeglut3-dev
// gcc main.c -o main -lGL -lglut
#include <GL/glut.h>
void drawVertices(GLenum mode, const void *vertices, int n_vertices){
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glDrawArrays(mode, 0, n_vertices);
}
@ErikHellman
ErikHellman / KittyLog.kt
Last active April 1, 2022 03:04
A super tiny wrapper for Android Log utility that allows log printing in unit tests. For a more advanced log wrapper for Android, see https://github.com/JakeWharton/timber/
/*
Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
This is a tiny log utility for Android Logcat. It allows logs to be used in code that is unit
tested on host (without Android framework available).
The only advantage with this utility above Timber is that it doesn't require any setup.
For real-world, production application I strongly recommend using Timber (see https://github.com/JakeWharton/timber/) instead.
*/
@file:Suppress("unused")
@curioustorvald
curioustorvald / UnsafePtr.kt
Last active January 2, 2024 20:17
Java/Kotlin unsafe pointer for unsafe array
package net.torvald
import sun.misc.Unsafe
/**
* Created by minjaesong on 2019-06-21.
*/
object UnsafeHelper {
internal val unsafe: Unsafe
@rumansaleem
rumansaleem / clean-up-arch-linux.md
Created May 28, 2019 08:51
Instructions to clean up Arch Linux (Manjaro)

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • remove old config files
  • Find and Remove
    • duplicates
    • empty files
    • empty directories
  • broken symlinks
@Lzyct
Lzyct / NetworkBoundResource.kt
Created February 28, 2019 02:05
NetworkBoundResource with Rx
abstract class NetworkBoundResource<ResultType, RequestType> {
private lateinit var result: Flowable<Resource<ResultType>>
init {
// Lazy disk observable.
val diskObservable = Flowable.defer {
loadFromDb()
// Read from disk on Computation Scheduler
.subscribeOn(Schedulers.computation())