Skip to content

Instantly share code, notes, and snippets.

// Parse string initData from telegram.
var data = HttpUtility.ParseQueryString(initData);
// Put data in a alphabetically sorted dict.
var dataDict = new SortedDictionary<string, string>(
data.AllKeys.ToDictionary(x => x!, x => data[x]!),
StringComparer.Ordinal);
// Constant key to genrate secret key.
var constantKey = "WebAppData";
@maxkagamine
maxkagamine / Nginx & certbot on Unraid.md
Last active March 9, 2024 09:01
Guide to running an nginx reverse proxy on Unraid with a Let's Encrypt wildcard cert, using the official nginx and certbot Docker images.

Nginx & certbot on Unraid

Here's a guide to running an nginx reverse proxy on Unraid with a Let's Encrypt wildcard cert (which can cover the Unraid web gui too), using the official nginx and certbot Docker images.

Other options:

  • caddy — popular nginx alternative with built-in automatic Let's Encrypt
  • pomerium — all-in-one reverse proxy, SSL, and OAuth-based login (compare to Caddy Security)
  • nginx-certbot — parses your nginx configs and manages certbot for you (see the original version of this gist for a script to copy your cert to Unraid)
  • swag — used to be called letsencrypt; has other things in it like PHP & f
@ArsalRaza
ArsalRaza / VideoUtils.java
Last active January 25, 2024 11:39
Extract Audio from Video, Mute Video, Crop Video from start, Crop Video from end Android MediaMuxer - JAVA
import android.annotation.SuppressLint;
import android.media.MediaCodec;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMetadataRetriever;
import android.media.MediaMuxer;
import android.util.Log;
import java.io.IOException;
import java.nio.ByteBuffer;
@kimyvgy
kimyvgy / MANUAL.md
Created May 24, 2018 01:52 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
@LouisCAD
LouisCAD / LifecycleCoroutines.kt
Last active July 3, 2022 11:47
CoroutineScope and Job integration with Lifecycle for Android. Meant to be used for your coroutines in lifecycle aware components. OUTDATED. See up to date implementation here: https://github.com/LouisCAD/Splitties/tree/master/modules/lifecycle-coroutines
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.Main
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job {
@nstarke
nstarke / release-android-debuggable.md
Last active March 17, 2024 08:14
How to make a Release Android App debuggable

How to make a Release Android App debuggable

Let's say you want to access the application shared preferences in /data/data/com.mypackage.
You could try to run adb shell and then run-as com.mypackage ( or adb shell run-as com.mypackge ls /data/data/com.mypackage/shared_prefs), but on a production release app downloaded from an app store you're most likely to see:

run-as: Package 'com.mypackage' is not debuggable