Skip to content

Instantly share code, notes, and snippets.

View bgola's full-sized avatar

Bruno Gola bgola

View GitHub Profile
#!/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 July 28, 2014 17:06
telegram markov chain bot
#!/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')
#!/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')
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:
#!/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 = {}
<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);
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):
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");
import java.util.Map;
PImage img;
int sf=0;
float frame = 0;
void setup() {
size(851, 315);
img = loadImage("path");
img.resize(width, height);
class Complex {
double real;
double img;
public Complex(double real, double img) {
this.real = real;
this.img = img;
}
public Complex multi(Complex b) {