Skip to content

Instantly share code, notes, and snippets.

View forabi's full-sized avatar
🎯
Focusing

M-Fawaz Orabi forabi

🎯
Focusing
View GitHub Profile
@konstantin24121
konstantin24121 / verifyTelegramWebAppData.tsx
Last active February 17, 2024 10:58
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
@forabi
forabi / auto_rtl.js
Last active April 11, 2016 17:50
Fix text direction for RTL articles on Pocket and file previews on GitHub and GitLab
// ==UserScript==
// @name Auto-RTL
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Fixes layout direction (RTL/LTR) for text on various websites
// @author You
// @match https://gitlab.com/*
// @match https://github.com/*
// @match http*://getpocket.com/beta/read/*
// @match http*://getpocket.com/read/*
@yocontra
yocontra / gulpfile.js
Last active January 1, 2016 00:29
gulpfile for a simple livereload static web server. this is a proof of concept that uses no plugins to do the work. obviously there are plugins that eliminate almost all of this code but i thought it would be a fun demonstration. this will trigger livereload any time any file is modified in the current working directory. it also serves the curre…
var gulp = require('gulp');
var gutil = require('gulp-util');
var express = require('express');
var path = require('path');
var tinylr = require('tiny-lr');
var createServers = function(port, lrport) {
var lr = tinylr();
lr.listen(lrport, function() {
gutil.log('LR Listening on', lrport);
@eLindemann
eLindemann / dabblet.css
Created April 1, 2013 20:41
"Google Now" Card
/**
* "Google Now" Card
*/
body {
background: #e1e1e1;
min-height: 100%;
margin: auto;
}
ul.gNow {
width: 450px;
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite