Skip to content

Instantly share code, notes, and snippets.

@piotrbelina
piotrbelina / .Xmodmap
Last active August 29, 2015 13:56
Linux Ubuntu Mac Keyboard
clear control
clear mod4
clear mod1
keycode 37 = Super_L
keycode 64 = Control_L
keycode 133 = Alt_L Meta_L
add mod1 = Alt_L Meta_L
add control = Control_L
@piotrbelina
piotrbelina / delete.sh
Created February 19, 2014 14:06
remove all branches on remote already merged to master
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v vendor |
grep -v rtm |
xargs -L1 |
awk '{sub(/origin\//,"");print}' |
xargs git push -v origin --delete
<?php
class B {}
class A {
protected $b;
public function __construct()
{
$this->b = new B();
@piotrbelina
piotrbelina / BoomerangLogJob.scala
Created August 3, 2013 10:12
Scalding apache log parser for boomerang.js
import cascading.tuple.{Fields, TupleEntry}
import com.twitter.scalding._
import java.net.URLDecoder
import scala.util.matching.Regex
class BoomerangLogJob(args: Args) extends Job(args) {
val input = TextLine(args("input"))
val output = TextLine(args("output"))
val trap = Tsv(args("trap"))
@piotrbelina
piotrbelina / Main.java
Created July 25, 2013 19:40
Cascading apache log parser for boomerang.js
package piotr;
import cascading.flow.Flow;
import cascading.flow.FlowDef;
import cascading.flow.hadoop.HadoopFlowConnector;
import cascading.operation.Aggregator;
import cascading.operation.aggregator.Average;
import cascading.operation.aggregator.Count;
import cascading.operation.regex.RegexFilter;
import cascading.operation.regex.RegexParser;
@piotrbelina
piotrbelina / categories.php
Created March 1, 2013 15:25
Magento categories export
<?php
/**
* Created by JetBrains PhpStorm.
* User: piotr
* Date: 01.03.13
* Time: 16:07
* To change this template use File | Settings | File Templates.
*/
require_once __DIR__ . '/../../../app/Mage.php';
@piotrbelina
piotrbelina / README.md
Last active December 14, 2015 03:49
This is a continous deploy script for crontab.

This is a continous deploy script for crontab. To use it:

  1. Create ~/bin/deploy.sh and copy script. Change mode to executable:
chmod + x ~/bin/deploy.sh
  1. Install crontab
@piotrbelina
piotrbelina / bootstrap.php
Created January 10, 2013 15:40
Bootstrap generator for Magento
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@piotrbelina
piotrbelina / gist:4040802
Created November 8, 2012 19:03
Dependency Injection using traits
<?php
class Container
{
protected $container = array();
public function get($name)
{
return $this->container[$name];
}
@piotrbelina
piotrbelina / ImageFetcher.php
Created August 17, 2012 13:57
Image Fetcher
<?php
class ImageFetcher
{
protected $url;
public function __construct()
{
libxml_use_internal_errors(true);
}