Skip to content

Instantly share code, notes, and snippets.

View s3va's full-sized avatar

Vsevolod Semenov s3va

  • Seva's studio apartment
  • Moskva (Moscow)
View GitHub Profile
@s3va
s3va / readme.txt
Created February 5, 2024 11:20
a VIDEO not a SHORT
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/
@s3va
s3va / AndroidManifest.xml
Created September 20, 2023 01:58
*#*#123123#*#*
<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/
@s3va
s3va / mailactivity.kt
Created August 1, 2023 21:54
running line
findViewById<TextView>(R.id.running_text).isSelected=true
@s3va
s3va / timeclient37.pl
Last active April 6, 2023 22:49
perl script to get unix time (port 37)
#!/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';
@s3va
s3va / AndroidKotlinDate-TimeStamp.kt
Created October 23, 2022 17:17
Android Kotlin Date-Time Stamp
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(Date())
@s3va
s3va / Activity.java
Created August 28, 2022 20:28
When can I View.getX() from View?
view.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// Layout has happened here.
// Don't forget to remove your listener when you are done with it.
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
@s3va
s3va / CustomDialogFragment.tk
Created July 8, 2022 14:46
Custom Dialog with vidgets pointers to change them programmatically
class CustDialogFragment(contentLayoutId: Int) : DialogFragment(contentLayoutId) {
lateinit var tv: TextView
lateinit var pb: ProgressBar
/**
* Override to build your own custom Dialog container. This is typically
* used to show an AlertDialog instead of a generic Dialog; when doing so,
* [.onCreateView] does not need
* to be implemented since the AlertDialog takes care of its own content.
@s3va
s3va / isServiceRunning.kt
Created June 22, 2022 14:43
Checking if my service is running.
private fun isMyServiceRunning(serv: String): Boolean {
val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
return manager.getRunningServices(Integer.MAX_VALUE)
.any {
Log.e(TAG, "isMyServiceRunning: ${it.service.shortClassName}")
it.service.shortClassName == serv
}
}
@s3va
s3va / MainActivity.diff
Created May 2, 2022 07:15
bottom navigation fix
-- val navController = findNavController(R.id.nav_host_fragment_activity_main)
++ val navController = (supportFragmentManager.findFragmentById(R.id.nav_host_fragment_activity_main) as NavHostFragment).navController
@s3va
s3va / MainActivity.java
Created April 28, 2022 20:44
Loop of images in ImageView
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
luup();
}
void luup() {
Integer[] i = {
R.drawable.chloe001,