Skip to content

Instantly share code, notes, and snippets.

View honzajavorek's full-sized avatar
🐣
improving junior.guru

Honza Javorek honzajavorek

🐣
improving junior.guru
View GitHub Profile
@honzajavorek
honzajavorek / htmllinks.php
Created May 31, 2011 20:48
Find and replace text URLs by HTML clickable links.
@honzajavorek
honzajavorek / gist:1262627
Created October 4, 2011 19:59
Demo: work with filesystem in Python
#!/usr/bin/python
# -*- coding: utf-8 -*-
# First line is for OS to know which interpreter to use when executing this file. You can easily determine where is your Python installation
# by typing `$ which python` into your bash terminal. You can of course run Python scripts this way: `$ python myscript.py`.
# Second line tells interpreter (and most editors, e.g. vim) that your file is in UTF-8. Any non-ASCII characters here, such as áéíóů
# will be treated as UTF-8 by Python interpreter thanks to this. See PEP 0263 for further info: http://www.python.org/dev/peps/pep-0263/
@honzajavorek
honzajavorek / gist:1325995
Created October 30, 2011 14:58
Co se dá dělat v Brně a tak vůbec

Co se dá dělat v Brně a tak vůbec :)

Vevnitř

  • hry: deskové hry, karetní hry, šachy, ...
  • divadlo (NDB, méně vážná divadla jako např. Buranteatr, Služebníci lorda Alfréda, ...)
  • kulečník (např. ve 14ce je za zálohu zadarmo, stačí přijít ve všední den jako např. ve čtvrtek)
  • kino (multiplexy, ART, letní kino na Dobráku)
  • sport (např. squash, plavání, ...)
  • tanec (jednorázové kurzy samby, klasické taneční kurzy)
@honzajavorek
honzajavorek / index.html
Created January 15, 2012 03:41
Detektor prasat
<!doctype html>
<html>
<head>
<title>Detektor prasat</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<a href="http://www.youporn.com">&nbsp;</a>
<a href="http://www.redtube.com">&nbsp;</a>
@honzajavorek
honzajavorek / index.php
Created January 15, 2012 03:42
minimální PHP controller
<?php
// tohle zjisteni rootu je docela prasecina, kdysi davno jsem to vymyslel a fungovalo to (dneska uz to za me delaji frameworky)
define('WEB_ROOT', rtrim(str_replace('\\', '/', (dirname($_SERVER['PHP_SELF']) == '/')? '' : dirname($_SERVER['PHP_SELF'])), '/'));
?>
<ul>
<li><a href="<?php echo WEB_ROOT ?>/neco">root/</a></li>
<li><a href="<?php echo WEB_ROOT ?>/neco">root/neco</a></li>
<li><a href="<?php echo WEB_ROOT ?>/neco/dalsiho">root/neco/dalsiho</a></li>
</ul>
@honzajavorek
honzajavorek / texy.php
Created January 18, 2012 21:35
Texy! in Python by subprocess (draft)
<?php
ini_set('display_errors', TRUE);
ini_set('html_errors', FALSE);
error_reporting(E_ALL | E_STRICT);
register_shutdown_function(function() {
$error = error_get_last();
if ($error !== NULL) {
if (empty($error['message'])) {
@honzajavorek
honzajavorek / wma2mp3.sh
Created January 28, 2012 21:24
Script to convert wma files to mp3
#!/bin/bash
for FILENAME in *.wma
do
NEW_NAME="`basename "$FILENAME" .wma`.mp3"
echo "$FILENAME → $NEW_NAME"
ffmpeg -i "$FILENAME" -acodec libmp3lame -ab 320k "$NEW_NAME"
done
@honzajavorek
honzajavorek / gist:1853867
Created February 17, 2012 14:43
A readable way how to work with Flask-SQLAlchemy
class Transaction(object):
def __init__(self, db):
self.db = db
def __enter__(self):
return self.db.session
def __exit__(self, type, value, traceback):
if not value:
@honzajavorek
honzajavorek / .gitmodules
Last active October 2, 2015 13:48
My Gist for reproducing Facebook bugs
[submodule "facebook"]
path = facebook
url = git://github.com/facebook/facebook-php-sdk.git
@honzajavorek
honzajavorek / pyvo.py
Created April 16, 2012 19:48
Jednoduchý FB group Pyonieri -> @naPyVo bot splácaný za hodinu na koleně
#!/usr/bin/python
# -*- coding: utf-8 -*-
import imaplib
import re
import base64
import quopri
import urllib
import redis