Skip to content

Instantly share code, notes, and snippets.

View alexandr7035's full-sized avatar

Alexandr alexandr7035

View GitHub Profile
# Put it to .github/workflows/stale.yml
name: Close stale issues and pull requests
on:
workflow_dispatch:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
@AbstractUmbra
AbstractUmbra / 00-deprecation.md
Last active October 26, 2025 12:01
discord.py 2.0+ slash command info and examples

This gist has now been 'deprecated' and has moved...

... to my blog style space for easier contribution by third parties and to provide what I believe to be an easier reading experience. Please field all enquiries and issues to the source repository.

@z0r0z
z0r0z / DAO Representation Agreement.md
Last active March 11, 2022 17:32
Agreement to establish off-chain representation on behalf of DAO. Can be useful to manage legal operations regardless of DAO legal structure.

DAO REPRESENTATION AGREEMENT

This DAO REPRESENTATION AGREEMENT (this “Agreement”) is made as of [[Effective Date]], by and between [[DAO Name]] (the “DAO”)[, a [[DAO Legal Structure]]] rooted on the [[Blockchain Name]], chainId:[[chainId]] at the public key [[DAO Public Key]] (the “Public Key”), and [[Representative Name]], a [[Representative Legal Structure]] (the “Representative”).

RECITALS

WHEREAS, the DAO desires to engage the Representative to manage its legal operational concerns, and the Representative desires to offer such services on the terms set forth herein;

NOW, THEREFORE, in consideration of the mutual covenants, agreements, representations and warranties contained herein, and intending to be legally bound hereby, the parties hereto hereby agree as follows:

@zach-klippenstein
zach-klippenstein / SegmentedControl.kt
Last active December 26, 2024 23:13
iOS-style segmented control in Compose
import android.annotation.SuppressLint
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.foundation.gestures.horizontalDrag
import androidx.compose.foundation.layout.Arrangement.spacedBy
import androidx.compose.foundation.layout.Box
@tuxuser
tuxuser / xbl_oauth2.py
Created September 2, 2020 09:15
Sign in to Xbox Live with OAUTH2
"""
Sign in to Xbox Live with OAUTH2
1. Go to https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
2. Register new app ("+ New registration")
2.1. Enter a name for your app
2.2. Set "Supported account types" to "Personal Microsoft accounts only"
2.3. Click register
2.4. Choose "Redirect URIs" -> "Add a Redirect URI"
2.5. Click "Add a platform" -> "Mobile and desktop applications"
@utkukutlu
utkukutlu / AndroidNavigationComponentDialogFragment
Last active November 11, 2023 13:51
android navigation component add fragment instead of replace
Android Navigation Component Dialog Fragment
@tomergoldst
tomergoldst / Singleton.kt
Last active August 21, 2021 21:11
Kotlin singleton pattern with class paramters
class Singelton private constructor(context: Context) {
companion object {
@Volatile
private var INSTANCE: Singelton? = null
fun getInstance(context: Context): Singelton =
INSTANCE ?: synchronized(this) {
INSTANCE ?: Singelton(context).also { INSTANCE = it }
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@ntoskrnl
ntoskrnl / JsonRpc.kt
Last active April 16, 2025 08:07
Retrofit-style JSON-RPC client in Kotlin (with gson serialization/deserialization)
fun <T, B> createJsonRpcService(service: Class<T>,
client: JsonRpcClient<B>,
resultDeserializer: Deserializer<B>,
logger: (String) -> Unit = {}): T {
val classLoader = service.classLoader
val interfaces = arrayOf<Class<*>>(service)
val invocationHandler = createInvocationHandler(service, client, resultDeserializer, logger)
@Suppress("UNCHECKED_CAST")