Skip to content

Instantly share code, notes, and snippets.

View jershell's full-sized avatar
🙆‍♂️
😓😘😨😭😸€

jershell jershell

🙆‍♂️
😓😘😨😭😸€
View GitHub Profile
import platform.UIKit.UIActivityViewController
import platform.UIKit.UIApplication
internal actual fun createShareIntent(message: String) {
val appDelegate = UIApplication.sharedApplication.delegate
val rootViewController = appDelegate?.window?.rootViewController
if (rootViewController != null) {
val activityItems = listOf(message)
val activityController = UIActivityViewController(
@the-spyke
the-spyke / pipewire.md
Last active May 15, 2024 16:41
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.

@filipelenfers
filipelenfers / installJdkTarGzUbuntu.sh
Last active May 16, 2024 20:16
Install JDK from tar.gz Ubuntu
#Login as root
sudo su
#create jdk directory
mkdir /opt/jdk
#uncompress, change to your file name
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
#check if files are there
@dlimpid
dlimpid / string-md5.kt
Created July 7, 2017 09:34
Get MD5 hash of the string (of length 32, with leading zeros) in Kotlin
import java.math.BigInteger
import java.security.MessageDigest
fun String.md5(): String {
val md = MessageDigest.getInstance("MD5")
return BigInteger(1, md.digest(toByteArray())).toString(16).padStart(32, '0')
}
@lynas
lynas / ankoFragment.java
Last active February 18, 2019 15:38
android fragment using anko
class MyFragment: Fragment(){
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return UI {
linearLayout{
editText()
button("OK")
}
}.view
}
}
@shrkw
shrkw / etc init.d unicorn-redmine
Last active July 6, 2016 01:22
init script for unicorn on RHEL, Cent OS, Scientific Linux way
#!/bin/sh
#
# unicorn_redmine Startup script for unicorn for redmine
#
# chkconfig: - 86 14
# processname: unicorn_rails
# pidfile: /opt/redmine/tmp/pids/unicorn.pid
# description: Rails application server for Redmine
#
### BEGIN INIT INFO