Skip to content

Instantly share code, notes, and snippets.

View jabbalaci's full-sized avatar

Laszlo Szathmary jabbalaci

View GitHub Profile
@jabbalaci
jabbalaci / wallpapers
Created April 6, 2014 17:32
38,157 wallpapers on Imgur
xBVcONf.jpg
lCOiFrN.jpg
QbFUTKA.jpg
v47ZH4i.jpg
86mqrYV.jpg
Cvk8T.jpg
FMJmGz4.jpg
lsyYPhu.jpg
Whoctyt.jpg
j28ALSI.jpg
@jabbalaci
jabbalaci / pyvideo_popularity.py
Created April 19, 2015 11:10
pyvideo popularity
#!/usr/bin/env python3
# encoding: utf-8
"""
I saw a similar script on the homepage of Miguel Grinberg (the Flask book guy),
but he was using webscraping. Here I use simple API calls instead.
The script takes the presentations of a Python conference and orders the
presentations in descending order by the number of youtube views. It
is an indicator about the popularity of a video.
@jabbalaci
jabbalaci / face_detect.py
Created May 11, 2011 03:28
Face Detection in Static Images with Python
#!/usr/bin/env python
"""
Origin: http://creatingwithcode.com/howto/face-detection-in-static-images-with-python/
Patched for Ubuntu 11.04 (the location of the XML file is different).
Installation:
sudo apt-get install python-opencv libcv-dev opencv-doc
"""
@jabbalaci
jabbalaci / get_page_with_cookiejar.py
Created September 12, 2011 02:33
download a cookie-protected page using cookielib
#!/usr/bin/env python
import os
import sqlite3
import cookielib
import urllib2
COOKIE_DB = "{home}/.mozilla/firefox/cookies.sqlite".format(home=os.path.expanduser('~'))
CONTENTS = "host, path, isSecure, expiry, name, value"
COOKIEFILE = 'cookies.lwp' # the path and filename that you want to use to save your cookies in
@jabbalaci
jabbalaci / hurdles.py
Created August 10, 2012 22:52
Play Hurdles 2012 (google doodle)
#!/usr/bin/env python
"""
Play http://www.google.com/doodles/hurdles-2012 .
Code based on https://gist.github.com/3287367 .
"""
import time
from autopy import key
@jabbalaci
jabbalaci / image_url.py
Created October 20, 2015 09:32
test if a URL is an image or not
#!/usr/bin/env python2
# encoding: utf-8
"""
test if a URL is an image or not
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
@jabbalaci
jabbalaci / alice.py
Created December 18, 2012 17:43
Alice chat bot
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
import termcolor
BOT_URL = 'http://www.pandorabots.com/pandora/talk?botid=a847934aae3456cb'
def main():
@jabbalaci
jabbalaci / szilvasbukta.py
Created January 3, 2014 12:23
image extractor for szilvasbukta.com posts without liking it
#!/usr/bin/env python
# encoding: utf-8
"""
Facebook is recently full of szilvasbukta.com links. However, if
you want to see an image, you must like it. WTF? This script extracts
the hidden image and opens it in your browser (in Firefox, by default).
dropped together by Jabba Laci (jabba.laci@gmail.com)
"""
@jabbalaci
jabbalaci / firefox.py
Created January 5, 2015 11:23
open tabs with Firefox in the background (as requested in http://redd.it/2rd2g9)
#!/usr/bin/env python2
"""
Automate your browser via telnet.
Requirements:
* Firefox
* MozRepl add-on (https://addons.mozilla.org/en-US/firefox/addon/mozrepl/)
- activate the add-on (under Tools -> MozRepl, "Start" and "Activate on startup")
Documentation of gBrowser:
@jabbalaci
jabbalaci / dokidoki.py
Created January 18, 2018 22:13
Extract text that is hidden in an image.
#!/usr/bin/env python3
"""
Extract data from http://users.atw.hu/std66/egyetem/monika.png .
It's from the game "Doki Doki Literature Club".
Tamás Sinku showed me this problem. He also described the
solution: take the middle of the image. A black pixel means 0,
while a white pixel means 1. Read it byte by byte and convert
it to text. You get a BASE64 string with some '\0' characters