This file contains hidden or 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
#!/bin/bash | |
sudo ip netns add tgspace | |
sudo ip netns exec tgspace ip link set lo up | |
sudo ip link add veth0 type veth peer name veth1 | |
sudo ip link set veth1 netns tgspace | |
sudo ip addr add 192.168.123.1/24 dev veth0 | |
sudo ip link set veth0 up | |
sudo ip netns exec tgspace ip addr add 192.168.123.2/24 dev veth1 | |
sudo ip netns exec tgspace ip link set veth1 up |
This file contains hidden or 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
<?php | |
// $files = glob("*.oga"); | |
$files = glob('*.{oga,mp3}', GLOB_BRACE); | |
sort($files); | |
function formatSize($bytes) { | |
if ($bytes >= 1048576) return number_format($bytes / 1048576, 2) . ' MB'; | |
if ($bytes >= 1024) return number_format($bytes / 1024, 2) . ' KB'; | |
return $bytes . ' bytes'; | |
} |
This file contains hidden or 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
class YourService : Service() { | |
private val job = SupervisorJob() | |
private val scope = CoroutineScope(Dispatchers.IO + job) | |
fun foo() { | |
scope.launch { | |
// Call your suspend function | |
} | |
} | |
override fun onDestroy() { |
This file contains hidden or 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
// https://stackoverflow.com/a/68228461/11798617 | |
private fun drawCircle300(): Bitmap? { | |
var radius = 150f | |
val bitmap = Bitmap.createBitmap( | |
(radius * 2).toInt(), | |
(radius * 2).toInt(), | |
Bitmap.Config.ARGB_8888 | |
) |
This file contains hidden or 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.serialization.DeserializationStrategy | |
import kotlinx.serialization.Serializable | |
import kotlinx.serialization.encodeToString | |
import kotlinx.serialization.json.* | |
import kotlinx.serialization.SerialName | |
@Serializable | |
@JsonClassDiscriminator("mytype") | |
sealed class ContentRequest |
This file contains hidden or 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
/** | |
* Usage : gsonBuilder.registerTypeAdapterFactory(JsonPreProcessingAdapterFactory()) | |
**/ | |
class JsonPreProcessingAdapterFactory : TypeAdapterFactory { | |
override fun <T> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? { | |
if (!Object::class.java.isAssignableFrom(type.rawType) || | |
Iterable::class.java.isAssignableFrom(type.rawType) |
This file contains hidden or 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
Just remove the 'shorts' from the URL and replace it with: 'watch?v=' | |
E.g.: youtube.com/shorts/XXXXXXX into: youtube.com/watch?v=XXXXX | |
https://www.reddit.com/r/youtube/comments/um9p9u/comment/j7j7im2/ |
This file contains hidden or 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
<receiver | |
android:name=".MySecretReceiver" | |
android:enabled="true" | |
android:exported="true"> | |
<intent-filter> | |
<action android:name="android.provider.Telephony.SECRET_CODE" /> | |
<data android:scheme="android_secret_code" android:host="123123"/> | |
</intent-filter> | |
</receiver> | |
http://simonmarquis.github.io/Android-SecretCodes/ |
This file contains hidden or 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
findViewById<TextView>(R.id.running_text).isSelected=true |
This file contains hidden or 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
#!/usr/bin/perl | |
use POSIX qw(strftime); | |
use IO::Socket::INET; | |
### binmode(STDIN); | |
$serverip = $ARGV[0]; | |
if(not defined $serverip){ | |
$serverip = '192.168.46.114'; |
NewerOlder