Skip to content

Instantly share code, notes, and snippets.

@seguri
seguri / index.js
Created May 8, 2023 23:58
Telegram Bot with Cloudflare Workers
/**
* After Save & Deploy, invoke `/register`
* Open Telegram, go to your bot, write something: you should receive it back.
*/
export default {
async fetch(request, env, context) {
const { headers } = request
const { hostname, pathname } = new URL(request.url)
const telegram = 'https://api.telegram.org/bot' + env.TOKEN
@seguri
seguri / keybase.md
Created June 18, 2019 14:32
keybase verification

Keybase proof

I hereby claim:

  • I am seguri on github.
  • I am seguri (https://keybase.io/seguri) on keybase.
  • I have a public key ASDHGBAkrnBQdNrjCDwzZlolH6jDzeZb6KLuhD99khm3jAo

To claim this, I am signing this object:

@seguri
seguri / main.py
Created February 28, 2017 16:31
Hamming(7,4)
#!/usr/bin/env python3
"""
Hamming(7,4) is a linear error-correcting code that encodes four bits of data
into seven bits by adding three parity bits.
The minimal Hamming distance between any two correct codewords is 3, and
received words can be correctly decoded if they are at a distance of at most one
from the codeword that was transmitted by the sender.
@seguri
seguri / Main.java
Created January 31, 2017 20:55
vat_validator
package com.example.vat_validator;
import eu.europa.ec.taxud.vies.services.checkvat.CheckVatPortType;
import eu.europa.ec.taxud.vies.services.checkvat.CheckVatService;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.ws.Holder;
public class Main {
#!/usr/bin/env python
#
# Add a youtube video to a youtube playlist.
# Usage:
# ./this.py --playlist-id <playlist_id> --video-id <video_id>
#
import httplib2
import os
import sys
@seguri
seguri / django-secret-key-generator.py
Created October 16, 2013 13:38
Django secret key generator
from os.path import join
from random import SystemRandom
valid_chars = list('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')
print(''.join(SystemRandom().sample(valid_chars, 50)))