Skip to content

Instantly share code, notes, and snippets.

View czerasz's full-sized avatar

Michał Czeraszkiewicz czerasz

View GitHub Profile
@czerasz
czerasz / gist:972350
Created May 14, 2011 16:09
Zend Framework Form all error messages
foreach ($form->getMessages() as $fieldName => $errorMessages) {
foreach ($errorMessages as $messageKey => $message) {
echo $fieldName.': '.$messageKey.' -> '.$message.'<br />';
}
}
@czerasz
czerasz / rails.sh
Created December 17, 2011 15:55
Ruby on Rails Project
#to use rails you need to compile rvm with ssl and readline
#http://dev.mensfeld.pl/2011/06/rvm-i-no-such-file-to-load-openssl/
#https://rvm.beginrescueend.com/packages/openssl/
#sudo apt-get install openssl libssl-dev libreadline6-dev
rvm pkg install openssl
rvm pkg install readline
rvm remove 1.9.2
rvm cleanup all
rvm install 1.9.2 --with-openssl-dir=$rvm_path/usr, --with-readline-dir=$rvm_path/usr
@czerasz
czerasz / gist:1669316
Created January 24, 2012 09:48
remove almost all gems
gem list | cut -d" " -f1 >> gemslist.txt
#remove from this gems You want to leave
more gemslist.txt | xargs gem uninstall -aIx
@czerasz
czerasz / .profile
Created February 1, 2012 12:19
My .profile
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# Set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
@czerasz
czerasz / file-start.rb
Created November 14, 2012 10:35
ruby helpers
#!/bin/env ruby
# encoding: utf-8
@czerasz
czerasz / server.js
Created August 30, 2013 06:37
node file upload
#!/usr/bin/env node
/*
* jQuery File Upload Plugin Node.js Example 2.1.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
@czerasz
czerasz / varnish.sh
Created October 1, 2012 15:03
varnish commands
# https://www.varnish-software.com/static/book/Getting_started.html#varnishlog
# View requests which are comming from the user to varnish
varnishlog -c -i RxURL
# View requests which are going from varnish to the backend
varnishlog -b -i TxURL
# BAN many objects at once - remember to implement the ban functionality in the /etc/varnish/default.vcl
curl -X BAN -H 'Host: some.host.net' 'http://localhost:80/url/.*'
@czerasz
czerasz / autossh.c
Last active July 25, 2016 01:58
useful commands
// Compile with
// gcc -o /etc/bin/autossh autossh.c
#include <stdio.h>
int main(int argc, char *argv[]) {
while(1) {
sleep(60);
printf(".\n");
}
}
@czerasz
czerasz / varnish-jsonp.vcl
Last active November 1, 2016 20:33 — forked from simonw/varnish-jsonp.vcl
Get Varnish to handle JSONP requests - working example
backend jsonp_varnish {
.host = "localhost";
.port = "80";
}
#------------- begin jsonp functionality -------------#
# How the jsonp_template_backend dispatches to the ESI generating code:
sub jsonp_throw_error_recv {
if (req.url == "/JSONP-ESI-TEMPLATE") {
error 760;

Keybase proof

I hereby claim:

  • I am czerasz on github.
  • I am czerasz (https://keybase.io/czerasz) on keybase.
  • I have a public key whose fingerprint is ED80 21A8 8730 9246 A278 881E D87F 15DA 25AB 9B5D

To claim this, I am signing this object: