Skip to content

Instantly share code, notes, and snippets.

Working from home

Tomáš Fejfar tomasfejfar

Working from home
Block or report user

Report or block tomasfejfar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tomasfejfar /
Last active Jul 29, 2019
"rebase" onto codebase that moved to different directory
#! /bin/bash
# usage: my-branch
# will create tag backup of current branch and rebase it on a moved directory
if [ -n "$(git status --porcelain)" ]; then
echo "You need to have clean working copy"
exit 1
git checkout $1
tomasfejfar / register-phpstorm-folder.reg
Created Mar 18, 2019
Register PhpStorm in context menu of directory
View register-phpstorm-folder.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\PHP Storm]
@="Open in &PHP Storm"
[HKEY_CLASSES_ROOT\Directory\shell\PHP Storm\command]
@="\"C:\\bin\\PhpStorm.cmd\" \"%1\""
tomasfejfar / composer.json
Created May 10, 2018
Local composer package
View composer.json
"repositories": [
"type": "path",
"url": "/path/to/project"
tomasfejfar / docker-compose.yml
Created Apr 3, 2018
Using YAML to reuse parts of existing docker-compose configuration
View docker-compose.yml
version: "3"
apache: &apacheConfig
build: .
- ./:/var/www/html:cached
- ./docker/php-apache/php.ini:/usr/local/etc/php/php.ini
- ./docker/php-apache/ssl-local:/etc/httpd/ssl
working_dir: /var/www/html
tomasfejfar / gist:5c92333b60143f189a69e8a9cde55811
Created May 29, 2017
Convert PDF to text file using tesseract and imagemagick in cygwin
View gist:5c92333b60143f189a69e8a9cde55811
Required cygwin packages:
* tesseract-ocr
* ghostscript
* imagemagick
usr/bin/convert.exe -density 400 input.pdf -depth 8 output.tiff
tesseract -l eng -psm 1 output.tiff output_textfile
View gist:30a8b7cc8f868da4045473cf06f87a0f
λ make serve
make[1]: Entering directory `W:/www/projects/flexproject'
/usr/bin/sh: make: command not found
make[1]: *** [serve_as_sf] Error 127
make[1]: Leaving directory `W:/www/projects/flexproject'
make: *** [serve] Error 2
tomasfejfar / page-A4.css
Last active Aug 5, 2017
Style to create a page-like div with the exact measurements of A4 paper
View page-A4.css
@media screen {
.page {
background: white;
width: 18cm;
height: 27.7cm;
display: block;
margin: 0 auto;
margin-bottom: 0.5cm;
box-shadow: 0 0 0.5cm rgba(0, 0, 0, 0.5);
padding: 1cm 1.5cm;
tomasfejfar / index.php
Last active Nov 16, 2016
Ošetření stránek pokud je vkládáme přímo z $_GET
View index.php
// v $page může být cokoli, nejen "kontakt" nebo nic. Takže potřebujeme zkontrolovat, že nám tam nepropadne něco co nechceme.
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'hlavni';
// uděláme pole se seznamem povolených hodnot
View db.php
$pdoOptions = [
$pdo = new PDO('mysql:host=;dbname=blog', 'root', '', $pdoOptions);
$statement = $pdo->prepare("SELECT * FROM posts");
$posts = $statement->fetchAll(PDO::FETCH_ASSOC);
tomasfejfar / sendmail.bat
Last active Nov 11, 2016
Windows fake sendmail to save mail to file
View sendmail.bat
@echo off
::where do we store the messages
SET mailpath=c:\xampp\tmp\mail\
if not exist %mailpath% mkdir %mailpath%
::create filename
echo %date:~0,11%
SET filename=%date:~11,4%-%date:~7,2%-%date:~3,2%_%hours%-%time:~3,2%-%time:~6,2%_%time:~9,2%
You can’t perform that action at this time.