Skip to content

Instantly share code, notes, and snippets.

View antonbabenko's full-sized avatar
🇺🇦

Anton Babenko antonbabenko

🇺🇦
View GitHub Profile
@antonbabenko
antonbabenko / README
Created October 25, 2011 18:38
Ticket #2388 (Symfony v2.0.4)
Instructions to reproduce the issue:
1) Download and unzip Symfony standard edition from here - http://symfony.com/download?v=Symfony_Standard_Vendors_2.0.4.tgz . It seems that this bug is not existing when do "git clone" and "bin/vendors install". Also this bug is not visible when using master or 2.0 branch.
2) Apply changes from files specified in this gist
3) Load http://localhost/Symfony/web/app_dev.php and see the error:
Fatal error: Allowed memory size of 1887436800 bytes exhausted (tried to allocate 523800 bytes) in /Users/Bob/Sites/Symfony/vendor/symfony/src/Symfony/Component/Translation/MessageCatalogue.php on line 127
Notes:
It happens only when translation key is not found in messages file, and cache is empty, and on first request (when reload the page session is restored and bug is not visible).
@antonbabenko
antonbabenko / curl_all.sh
Created January 12, 2012 14:44
Curl list of urls and save http response code & times (useful for cache warmup)
#!/bin/bash
while read LINE; do
curl -o /dev/null --silent --progress-bar --head --write-out '%{http_code} %{time_starttransfer} %{url_effective}\n' "$LINE" >> urls_result.txt
done < urls.txt
@antonbabenko
antonbabenko / s3backup.sh
Created March 12, 2012 12:36
S3 files backup command
s3cmd --recursive --reduced-redundancy --skip-existing --no-delete-removed --acl-public sync s3://s3.domain.com/files/ s3://s3-backup.domain.com/files/
@antonbabenko
antonbabenko / gist:2462549
Created April 22, 2012 07:47
git pre-commit phpcs hook
# https://github.com/s0enke/git-hooks/tree/master/phpcs-pre-commit/
curl -o .git/hooks/pre-commit https://raw.github.com/s0enke/git-hooks/master/phpcs-pre-commit/pre-commit
chmod +x .git/hooks/pre-commit
Specify Symfony2 as standards in pre-commit.
Also there is Netbeans plugin to verify coding style.
Profit! :)
@antonbabenko
antonbabenko / gist:3156298
Created July 21, 2012 16:15
Useful shell commands (network, Varnish, etc)
# Show which process is on this port:
netstat -tulpn | grep :80
# List urls which miss:
varnishtop -i txurl
# Activity by IP:
varnishlog -b -m TxHeader:88.88.88.88
# Purge URL from curl:
@antonbabenko
antonbabenko / vm.html
Created July 26, 2013 08:15
VM in iframe
<!DOCTYPE html>
<html>
<head>
<title>VM iframe</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<iframe src="http://www.victoriamilan.com/" scrolling="no" style="width: 1000px; height: 800px; border: 0px; overflow: auto;"></iframe>
@antonbabenko
antonbabenko / circle.yml
Created September 4, 2013 17:24
Disabling all builds in circle.yml
# test
machine:
environment:
CIRCLECI: false
CI: false
branches:
ignore:
- /.*/
@antonbabenko
antonbabenko / cors.inc
Last active November 18, 2023 20:22
(nginx AND varnish) + CORS (working example)
more_set_headers "Access-Control-Allow-Origin: $http_origin";
more_set_headers "Access-Control-Allow-Credentials: true";
# OPTIONS indicates a CORS pre-flight request
if ($request_method = 'OPTIONS') {
more_set_headers "Access-Control-Max-Age: 1728000";
more_set_headers "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS";
more_set_headers "Access-Control-Allow-Headers: Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since";
more_set_headers "Content-Length: 0";
@antonbabenko
antonbabenko / myip.sh
Created February 28, 2014 08:37
Extract your external IP from command line
dig +short myip.opendns.com @resolver1.opendns.com
@antonbabenko
antonbabenko / ubuntu_apptus
Created March 28, 2014 18:29
Run Apptus on Ubuntu (using Vagrant)
# Run Apptus on Ubuntu (using Vagrant)
# vagrant up
# vagrant ssh
sudo apt-get install openjdk-7-jdk
/esales/install_server.sh
######