Skip to content

Instantly share code, notes, and snippets.

View Antiokh's full-sized avatar
:electron:
You know, I'm something of a scientist

Anton Nazarov Antiokh

:electron:
You know, I'm something of a scientist
View GitHub Profile
@Malith-Rukshan
Malith-Rukshan / validateInitData.py
Last active April 22, 2025 02:36
Validate Init data of Telegram Mini-App | TypeScript & Python
import hmac
def checkValidateInitData(hash_str, init_data, token, c_str="WebAppData"):
"""
Validates the data received from the Telegram web app, using the
method documented here:
https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
hash_str - the has string passed by the webapp
init_data - the query string passed by the webapp
@FelixZY
FelixZY / supabase_api_auth.sql
Last active April 14, 2025 00:51
How to configure Supabase (https://supabase.com/) to generate and accept API tokens.
-- Token Based API Access for Supabase
--
-- How to configure Supabase (https://supabase.com/) to generate and accept API tokens.
--
-- (c) 2022 Felix Zedén Yverås
-- Provided under the MIT license (https://spdx.org/licenses/MIT.html)
--
-- Disclaimer: This file is formatted using pg_format. I'm not happy with the result but
-- prefer to follow a tool over going by personal taste.
--
@MakStashkevich
MakStashkevich / telegram_web_app_bot_validate_hash.js
Last active April 22, 2025 02:36
Telegram Web App Bot (Validate hash function) on Javascript (JS or NodeJs)
// Bot token
const bot_token = '0123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
function isValidHash() {
// Parse query data
const parsedData = Telegram.Utils.urlParseQueryString(Telegram.WebApp.initData)
// Get Telegram hash
const hash = parsedData.hash
@bmcbride
bmcbride / sqlite_geojson.php
Created February 27, 2012 02:08
PHP SQLite to GeoJSON
<?php
/**
* SQLite to GeoJSON (Requires https://github.com/phayes/geoPHP)
* Query a SQLite table or view (with a WKB GEOMETRY field) and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The SQLite table name *REQUIRED*
* @param string $geomfield The WKB GEOMETRY field *REQUIRED*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)*
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
* @param string $orderby SQL ORDER BY constraint *OPTIONAL*