Skip to content

Instantly share code, notes, and snippets.


Jan Pecha janpecha

View GitHub Profile
geekmanager / make-git-use-sublime.markdown
Last active November 20, 2022 20:47
Making git use Sublime Text for rebase etc
View make-git-use-sublime.markdown

Making git use Sublime Text

First up, let's make Sublime Text 2 available from the command line in terminal, by creating a link to subl which is the launcher from terminal:

ln -s /Applications/Sublime\ Text\ /usr/local/bin/sublime

(added bonus of this approach is when you upgrade to ST3 or change text editor, you can just redirect the symlink).

If there's any chance that bash doesn't check usr/local/bin then use [Launch Sublime Text 2 from Mac OSX Terminal] for more detailed instructions on how to make this happen.

milo / github-webhook-handler.php
Last active November 9, 2022 16:40
GitHub Webhook Handler
View github-webhook-handler.php
* GitHub webhook handler template.
* @see
* @author Miloslav Hůla (
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
mkaraki /
Created February 15, 2020 10:09
Install ffmpeg codec for Opera in Linux (Ubuntu)
# for Ubuntu
# Install pre-requirements
sudo apt-get update
sudo apt-get install -y chromium-codecs-ffmpeg-extra
# Import to opera
sudo ln -sf /usr/lib/chromium-browser/ /usr/lib/x86_64-linux-gnu/opera/
senko /
Created August 18, 2011 16:52
Watch current directory and execute a command if anything in it changes
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
# Written by: Senko Rasic <>
# Requires Linux, bash and inotifywait (from inotify-tools package).
# To avoid executing the command multiple times when a sequence of
View gist:d98cac53fdfd1a7176609e9687345be7
I have just discovered a great feature of composer:
composer update --lock
It saves a lot of time when you merge branches with composer.lock file changes in both branches.
Just resolve conflict by applying --ours version of the file (or --theirs, it really doesn't matter) and then run
`composer update --lock `.
Composer will do all the dirty work for you and update composer.lock file according to composer.json changes
and install new packages. The rest of packages in composer are not changed.
juzna /
Last active November 9, 2021 07:27
Server Configuration in git

Server Configuration in git

With git you can have anything versioned. You're used to version your code, which is a bunch of files. Your server configuration (on Linux) is also just a bunch of files, so it can be versioned as well.

The idea is simple: create a git repository in /etc/ and commit everytime you change any configuration of your server. Written in code:

cd /etc
git init
git add .
hauke96 /
Last active September 16, 2021 10:57
Install in vivaldi

Install in vivaldi

This short instruction shows how to install in vivaldi to play e.g. mp4 videos.

I use the ubuntu repository for that but this is just one way to get the file.

1. Download .deb package

Go to and choose the latest chromium-codecs-ffmpeg-extra and download it.

For example: chromium-codecs-ffmpeg-extra_58.0.3029.110-0ubuntu1.1354_amd64.deb

dg / composing.presenters.php
Created May 31, 2018 14:00
Composing presenters without inheritance
View composing.presenters.php
// composing presenters without inheritance
// (requires nette/application 2.4.11)
trait RequireLoggedUser
public function injectRequireLoggedUser()
dg / websocket.html
Created August 11, 2013 15:54
WebSocket communication between PHP and single client
View websocket.html
<!doctype html>
if ("WebSocket" in window) {
var ws = new WebSocket("ws://");
ws.onopen = function() {
ws.onerror = function(e) {
mibk / BaseQuery.php
Last active December 14, 2018 10:36
LeanMapperQuery suggested base classes.
View BaseQuery.php
namespace Model\Entity;
use LeanMapperQuery\Entity;
use LeanMapperQuery\IQuery;
use Model\Query\EntityQuery;
class BaseEntity extends Entity