Skip to content

Instantly share code, notes, and snippets.

View ThanosFisherman's full-sized avatar

Thanos Psaridis ThanosFisherman

View GitHub Profile
@AdnanHabibMirza
AdnanHabibMirza / NetworkMonitor.kt
Last active July 22, 2024 13:45
Monitor network connectivity in android using callbackFlow.
interface NetworkMonitor {
val isOnline: Flow<Boolean>
}
class NetworkMonitorImpl @Inject constructor(
@ApplicationContext private val context: Context,
@Dispatcher(IO) private val ioDispatcher: CoroutineDispatcher,
) : NetworkMonitor {
override val isOnline: Flow<Boolean>
get() = callbackFlow {
@mcroteau
mcroteau / build.gradle.kts
Created February 21, 2022 21:43
Example Kotlin DSL for publishing to Maven Central with Dokka and Sources
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.dokka") version "1.6.10"
id("maven-publish")
id("java-library")
id("signing")
id("jacoco")
application
kotlin("jvm") version "1.6.10"
@tatumroaquin
tatumroaquin / archlinux-qemu-kvm.md
Last active November 15, 2024 05:16
QEMU-KVM Installation for Arch Linux

QEMU-KVM in Arch Linux

Check Virtualization Support

Check CPU has VM capabilities

lscpu | grep -i Virtualization
  • VT-x for Intel
  • AMD-Vi for AMD
@the-spyke
the-spyke / pipewire.md
Last active November 15, 2024 01:05
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

@LeviSnoot
LeviSnoot / discord-timestamps.md
Last active November 9, 2024 14:25
Discord Timestamp Syntax

Discord Timestamps

Discord timestamps can be useful for specifying a date/time across multiple users time zones. They work with the Unix Timestamp format and can be posted by regular users as well as bots and applications.

The Epoch Unix Time Stamp Converter is a good way to quickly generate a timestamp. For the examples below I will be using the Time Stamp of 1543392060, which represents November 28th, 2018 at 09:01:00 hours for my local time zone (GMT+0100 Central European Standard Time).

Formatting

Style Input Output (12-hour clock) Output (24-hour clock)
Default <t:1543392060> November 28, 2018 9:01 AM 28 November 2018 09:01
@protrolium
protrolium / bitwig-keyboard-shortcuts.md
Last active March 11, 2023 18:07
various keyboard shortcuts for controlling Bitwig Studio DAW

Bitwig Studio Keyboard Shortcuts

1-5 - Tools
ctrl + enter - commander
0 - deactivate clip (Toggle Active)
b - insert from library
shift + f - follow playhead
/ - toggle adaptive beat grid

Panels:

@MichaelCurrin
MichaelCurrin / install-ruby-bundler.md
Last active September 15, 2024 21:17
Install Ruby 3 and Bundler

Install Ruby 3 and Bundler

Resources:

1. Install Ruby

@zsmb13
zsmb13 / publish-mavencentral.gradle
Last active April 21, 2021 07:25
Basic MavenCentral script
apply plugin: 'maven-publish'
apply plugin: 'signing'
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
} else {
from sourceSets.main.java.srcDirs
@ityonemo
ityonemo / test.md
Last active October 25, 2024 15:24
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@ychescale9
ychescale9 / build.gradle.kts
Last active June 5, 2024 22:56
Customizing APK file name with new AGP variant APIs
android {
onVariantProperties {
val mainOutput = outputs.single { it.outputType == VariantOutputConfiguration.OutputType.SINGLE }
tasks.register<CreateRenamedApk>("createRenamedApkFor${name}") {
this.originalApkFolder.set(artifacts.get(ArtifactType.APK))
this.builtArtifactsLoader.set(artifacts.getBuiltArtifactsLoader())
this.newApkFolder.set(layout.buildDirectory.dir("outputs/renamed_apk/${[email protected]}"))
this.versionCode.set(mainOutput.versionCode)
this.versionName.set(mainOutput.versionName)
}