Skip to content

Instantly share code, notes, and snippets.

View telegrambot.py
#!/usr/bin/python2
from subprocess import Popen, PIPE, STDOUT
from functools import partial
import re, datetime, random
ansi_escape = re.compile(r'\x1b[^m]*m')
p = Popen(['telegram'], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
p.stdout.read(255)
@bgola
bgola / gist:a38209d77b28b4e15368
Created Jul 28, 2014
telegram markov chain bot
View gist:a38209d77b28b4e15368
#!/usr/bin/python2
# coding: utf-8
from subprocess import Popen, PIPE, STDOUT
from functools import partial
import re, datetime, random, time
from glob import glob
CHAIN_LENGTH=2
END = '\0'
ansi_escape = re.compile(r'\x1b[^m]+m')
View telegrambot.py
#!/usr/bin/python2
# coding: utf-8
from subprocess import Popen, PIPE, STDOUT
from functools import partial
import re, datetime, random, time
from glob import glob
CHAIN_LENGTH=2
END = '\0'
ansi_escape = re.compile(r'\x1b[^m]+m')
View gist:63ecd0071db2e021e4b6
import random
def glitch(jpg):
f = open(jpg, 'r')
new = f.read(400)
for c in f.read():
if random.random() > random.choice([0.9992, 0.9993, 0.9994, 0.9995, 0.9996, 0.9997, 0.9998, 0.9999]):
new += chr(int(ord(c) + random.random()*random.choice(range(100)))%256)
else:
View markov.py
#!/usr/bin/python2
# coding: utf-8
import re, datetime, random, time
CHAIN_LENGTH=3
START = '\1'
END = '\0'
ansi_escape = re.compile(r'\x1b[^m]+m')
data = {}
View midkov.py
#!/usr/bin/python2
# coding: utf-8
import re, datetime, random, mido, sys, time
data = {}
def split(seq):
for i in range(len(seq) - 2):
yield tuple(seq[i:i+3])
View gist:b850760d052cd5da6cac
<html>
<head>
<title>yay</title>
<script type="text/javascript">
var arrx = [];
var arry = [];
var arrz = [];
for (var i=0; i<100; i++) {
arrx.push(0);
arry.push(0);
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View gameoflife_term.py
import os, random, time, fcntl, termios, struct
# SETUP
BACKGROUND=" "
FILL="."
BUFFER = []
FRAMERATE = 20
# To get terminal number of lines and columns
def ioctl_GWINSZ(fd):
View order.pde
import java.util.Map;
PImage img;
float line_size = 30;
float space = 20;
int sf=0;
float frame = 0;
void setup() {
size(700, 700);
img = loadImage("/home/bgola/fotos/me/mequadrado2.jpg");
You can’t perform that action at this time.