Skip to content

Instantly share code, notes, and snippets.

@FabianPastor
FabianPastor / TelegramWebValidator.php
Last active February 10, 2023 22:20
Just a small Telegram Auth Data validator class for PHP.
<?php
// TelegramWebValidator.php
namespace SFPL\Telegram;
class WebDataException extends \Exception{};
class WebValidator
{
private string $bottoken;
private int $time_to_expire = 86400;
@FabianPastor
FabianPastor / Dockerfile
Created November 16, 2018 14:59
Docker Container for tdlib development
FROM debian:sid-slim
LABEL maintainer="FabianPastor" \
version="0.1" \
description="Dockerfile for building Telegram TDLib"
RUN apt-get update \
&& apt-get install -y --force-yes git build-essential gcc-5 g++-5 cmake \
gperf openssl libssl-dev ccache zlib1g-dev libreadline-dev \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 \
@FabianPastor
FabianPastor / Dockerfile
Created September 19, 2018 11:58
Dockerfile for Building static git binary for CentOS6.8
FROM centos:6.8 #Informatic class OS //Centos 6.8
RUN yum -y update
RUN yum -y install git gettext gettext-devel zlib-devel libcurl-devel tcp_wrappers-devel libxml2 libxml2-devel libxslt libxslt-devel expat-devel openssl-devel gcc make
RUN mkdir -p /app/git-static
WORKDIR /app
RUN git clone --recursive https://github.com/git/git.git --depth 1
# --recursive because centos has an outdated git version
RUN cd git && \
@FabianPastor
FabianPastor / moodle.php
Created September 18, 2018 18:56
Pequeño script para usar la API REST de Moodle del AulaVirtual de la Universidad de Valencia
#!/usr/bin/php
<?php
$function = "core_webservice_get_site_info";
$host = "https://aulavirtual.uv.es";
$apiRest = "/webservice/rest/server.php";
$token = "0123456789";
$options = new stdClass();
$options->moodlewsrestformat = "json";
@FabianPastor
FabianPastor / telegram_login_widget.class.php
Created February 8, 2018 21:55
Telegram Login Widget class derived from official samples
<?php
/*
Derived work from https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2
More info at: https://core.telegram.org/widgets/login
*/
class TelegramUserData{
public $auth_data = false; //The data itself
private $outdated = 86400; //Secconds to consider some info outdated.
private $bottoken = "YOUTBOTTOKEN";
@FabianPastor
FabianPastor / iana_langs.php
Created June 13, 2017 12:58
Small script to download and format into JSON the IANA Languages subtag registry
<?php
$iana_lang_subtags_file = 'iana_lang_subtags.txt';
$iana_lang_subtags_url = 'https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry';
$iana_lang_subtags_json = 'iana_lang_subtags.json';
$update = false; if(isset($argv[1])) $update = true;
$langs = new stdClass;
$langs->metadata = new stdClass;
$uri = $iana_lang_subtags_file;
@FabianPastor
FabianPastor / index.php
Last active January 31, 2017 11:47
Route file for mirroring telegram desktop update system
<?php
/************************
** Author: FabianPastor
** Description: Simple route file for mirroring telegram desktop update system
**
** You can test it in local by using the PHP integrated Webserver:
** $ php -S localhost:8080 index.php
** Also if you want to use it on Apache2 make sure you have mod_rewrite enabled.
** This would be the content for the .htaccess
DirectorySlash Off
<?php
namespace GitHub\Status;
class API{
//This URLS Can change in any time.
protected $urls=[
"status.github.com",
"octostatus-production.github.com",
"octostatus-9676240.us-east-1.elb.amazonaws.com",
"54.243.208.39",
"107.22.212.99",
#!/bin/bash
# Get the coordinates of the active window's
# top-left corner, and the window's size.
# This excludes the window decoration.
unset x y w h
eval $(xwininfo |
sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
-e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
-e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
@FabianPastor
FabianPastor / TDesktopDependencies.sh
Last active October 16, 2017 12:17
Instalador de dependencias de TDesktop para Ubuntu 12.04
#!/bin/bash
cpus="6"
# zlibv="1.2.8"
opusv="v1.2-alpha2"
ffmpegv="3.2"
portaudiov="pa_stable_v19_20140130_r1919"
opensslv="OpenSSL_1_0_1-stable"
cmakev="3.6.2" #Cuidado al cambiar esto. Tener en cuenta gyp/refresh.sh
tddir="tdesktop"