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 / example.py
Last active December 16, 2015 13:29
"Decorate to register"
###
### I want to collect some functions (or classes) for further use.
###
# Option 1: IMPLICIT (similar to CONVENTION OVER CONFIGURATION)
# Convention = all functions have the same prefix.
def compute_bullshit(...):
@honzajavorek
honzajavorek / fill-by-zeros.sh
Created February 15, 2013 10:30
PHP/shell script to fill a disk by zeros, useful when you want to completely clear a disk without any option of restoring original data
#!/bin/bash
echo "<?php \$i = 0; while(true) if (false === @file_put_contents('zerofile' . \$i, str_repeat('0', 134217728), FILE_APPEND)) \$i++;" | php
rm zerofile*
#!/bin/sh
DATE=`date '+%Y-%m-%d'` # dnesni datum
DIR="/tmp/stahovanky/$DATE" # cilova slozka
mkdir -p "$DIR" # kdyby nahodou slozka neexistovala, vytvorime ji
# stahujeme jak je libo
wget http://www.honzajavorek.cz/index.html -P "$DIR"
wget http://www.honzajavorek.cz/archives.html -P "$DIR"
@honzajavorek
honzajavorek / setup.py
Created January 23, 2013 20:07
HOWTO: gevent==1.0dev as a regular dependency in setup.py
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
...,
install_requires=[
...
@honzajavorek
honzajavorek / colored_formatter.py
Created October 5, 2012 07:53
Logging formatting
# -*- coding: utf-8 -*-
import logging
from termcolor import colored
class ColoredFormatter(logging.Formatter):
def _colorize(self, record):
@honzajavorek
honzajavorek / about.md
Created August 29, 2012 12:21 — forked from sputnikus/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

@honzajavorek
honzajavorek / install.sh
Created August 18, 2012 08:24
One-liners to install dependencies from txt file similar to pythonic requirements.txt
#!/bin/bash
cat ubuntu_requirements.txt | xargs apt-get -y install
cat ruby_requirements.txt | xargs gem install
pip install -r python_requirements.txt
@honzajavorek
honzajavorek / index.php
Last active October 8, 2015 01:58
Apache root index file
<?php
if (!empty($_GET['phpinfo'])) {
phpinfo();
exit;
}
function run($cmd) {
$output = array();
exec($cmd, $output);
return implode("\n", $output);
@honzajavorek
honzajavorek / less.sh
Created July 9, 2012 14:50
Setup scripts
#!/bin/bash
echo "LESS installation."
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
sudo npm install -g less
@honzajavorek
honzajavorek / gist:2972331
Created June 22, 2012 11:58
How to setup Gmail filter to get rid of Google+ spam

How to setup Gmail filter to get rid of Google+ spam

Google+ sends you spam even you are not part of it. If you try to click on unsubscribe link, it leads you to sign up form to Google+. That is insane. The only defense is to report it as spam and use this:

Matches

from:(@plus.google.com)
subject:((invited you to join Google+) OR (do svých kruhů a zve vás na Google+) OR (příspěvky na Google+) OR (sharing with you on Google+))

Do this

Skip Inbox, Delete it