Skip to content

Instantly share code, notes, and snippets.

View pingiun's full-sized avatar

Jelle Besseling pingiun

View GitHub Profile
from telegram.ext import Updater, CommandHandler, MessageHandler
from sqlalchemy import Column, BigInteger
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlite3 import IntegrityError
import logging
import random
import re
import sys
from datetime import datetime
from b2.api import B2Api
def parse(inp, mformat=None, thing=None):
if thing is None:
thing = 'th'
if mformat is None:
@pingiun
pingiun / DeadMansSwitch.sol
Last active August 2, 2020 11:15
Ethereum contract which only pays back if you continue to activate it
pragma solidity ^0.4.0;
contract Ownable {
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
@pingiun
pingiun / emojiencode.py
Last active September 22, 2022 18:36
Emojiencode can be used to encode a hash in emoji, like Telegram is doing for secret voice calls
# -*- coding: utf-8 -*-
# This alphabet is handpicked to be visually distinctive
_alphabet = ['☕️', '🐜', '✉️', '🎋', '👟', '📺', '😅', '✌️', '🌰', '🍇',
'🐶', '👢', '💉', '💈', '⚡️', '🌹', '🗽', '👌', '💔', '🎈',
'🥑', '⌚️', '🚿', '🐫', '🔧', '🔌', '😈', '💳', '😊', '👍',
'🍞', '😘', '🎯', '⛄️', '🔦', '🐳', '🍌', '‼️', '🥝', '✂️',
'🎄', '💥', '🍷', '🚦', '📬', '🎡', '🎆', '🔍', '🍻', '🏭',
'🎶', '💡', '🏄', '👂', '🗡️', '🍒', '👑', '🚃', '🙏', '❌',
'💾', '🙋', '👸', '🔪', '👎', '🌊', '🍕', '⚽️', '🎁', '🏈',
FROM python:3
MAINTAINER Jelle Besseling <jelle@pingiun.com>
COPY . /app
WORKDIR /app
RUN pip install uwsgi && pip install -r requirements.txt
@pingiun
pingiun / openpgp.txt
Created September 9, 2016 08:59
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:a3a365ae16eda7a0c29c88f19712452e8be3372e]

Keybase proof

I hereby claim:

  • I am pingiun on github.
  • I am pingiun (https://keybase.io/pingiun) on keybase.
  • I have a public key whose fingerprint is A3A3 65AE 16ED A7A0 C29C 88F1 9712 452E 8BE3 372E

To claim this, I am signing this object:

#!/usr/bin/env python
import os
import markdown2
with open('head.html') as f:
head = f.read()
with open('foot.html') as f:
foot = f.read()
@pingiun
pingiun / httperrorserver.py
Last active August 7, 2016 11:37
A simple http server that returns the requested error
#!/bin/env python
from __future__ import print_function
import argparse
import sys
try:
import BaseHTTPServer
@pingiun
pingiun / zoombot.py
Last active May 14, 2021 22:41
FaceZoomBot uses facerect on mashape.com to zoom in on faces in photos on Telegram (@FaceZoomBot)
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2016 Jelle Besseling
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell