Skip to content

Instantly share code, notes, and snippets.

View vasia123's full-sized avatar

Vasily Krakovetsky vasia123

View GitHub Profile
@noxx3xxon
noxx3xxon / arbitrage.py
Created August 21, 2022 22:34
CFMM Routing Arbitrage Example
import numpy as np
import cvxpy as cp
import itertools
# Problem data
global_indices = list(range(4))
# 0 = TOKEN-0
# 1 = TOKEN-1
# 2 = TOKEN-2
@konstantin24121
konstantin24121 / verifyTelegramWebAppData.tsx
Last active November 17, 2024 17:34
Telegram Bot 6.0 Validating data received via the Web App node implementation
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => {
// The data is a query string, which is composed of a series of field-value pairs.
const encoded = decodeURIComponent(telegramInitData);
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key.
const secret = crypto

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

@pete-rai
pete-rai / find-image-in-image.js
Created January 13, 2021 17:29
Find an image within another image using nodejs, using the node sharp library (https://www.npmjs.com/package/sharp). Note: This does not handle PNG transparencies - I may add that next - let me know if you need it.
const sharp = require('sharp');
async function findImageWithinImage(outer, inner, max = 1) // max is the maximum occurences to find
{
let file_o = sharp(outer);
let file_i = sharp(inner);
let buff_o = await file_o.raw().toBuffer();
let buff_i = await file_i.raw().toBuffer();
let meta_o = await file_o.metadata();
let meta_i = await file_i.metadata();
@Zhendryk
Zhendryk / The Ultimate Windows Development Environment.md
Last active September 14, 2024 01:16
How to set up the ultimate Windows development environment
@xsduan
xsduan / async_sqlite.py
Last active April 3, 2024 17:27
peewee-async sqlite connection doohicky
"""
Temporary module to allow for sqlite databases during development. Remove once
we get an actual database.
"""
import peewee
from peewee_async import AsyncDatabase
import playhouse.sqlite_ext as sqlite_ext
try:
import aiosqlite
@mosquito
mosquito / proxy.py
Last active May 5, 2022 05:25
AIOHTTP async proxy streaming
import platform
import unittest
from http import HTTPStatus
from urllib.parse import urlencode, unquote
import aiohttp
import asynctest
from aiohttp import web
from aiohttp.test_utils import TestClient
from multidict import MultiDict
@jlccaires
jlccaires / UploadModal.vue
Last active January 5, 2021 12:55
Vue upload, gallery, preview, progress using vue-upload-component, Buefy, ElementUI and filesize.js
<template>
<b-modal :active="true" :onCancel="close">
<div class="modal-card">
<section class="modal-card-body">
<nav class="level">
<div class="level-left">
<el-tooltip v-if="errorFiles.length" placement="bottom" effect="light">
<div slot="content">
<div>
Alguns arquivos não puderam ser enviados:
@mfd
mfd / 06.png
Last active October 30, 2024 08:02
Gilroy font
06.png
anonymous
anonymous / japanese.md
Created March 18, 2017 10:44
japanese.md