Skip to content

Instantly share code, notes, and snippets.

apt-get install bootlogd
sed $'s/\^\[/\E/g;s/\[1G\[/\[27G\[/' /var/log/boot
@gjuric
gjuric / piwik-nginx.conf
Created January 9, 2015 17:55
Piwik nginx configuration
server {
listen 80 default;
server_name stats.example.com;
return 301 https://stats.example.com$request_uri;
}
upstream php-fpm {
server unix:/var/run/php5-fpm.sock;
@gjuric
gjuric / osx-install.txt
Created January 9, 2015 17:52
OSX dev install
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
brew install mysql nginx mongodb redis rabbitmq
brew install php55 --with-fpm --with-imap --with-homebrew-openssl php55-imagick php55-mongo php55-pcntl php55-pspell php55-redis php55-xdebug php55-apcu
sudo chown root /usr/local/opt/nginx/homebrew.mxcl.nginx.plist
sudo gem install --no-ri --no-rdoc capistrano -v 2.15.5
PHP:
php-fpm.conf (display-errors)
/usr/local/etc/php/5.5/conf.d/99-custom.ini:
@gjuric
gjuric / gist:e0c9e45efb3d15e3b949
Created December 11, 2014 14:13
PHP-FPM log to syslog
/etc/php5/fpm/php-fpm.conf
error_log = syslog
syslog.ident = php-fpm
This will log to syslog PHP-FPM stuff that usually gets logged to /var/log/php5-fpm.log and is not that interesting:
... php-fpm[3537]: [NOTICE] fpm is running, pid 3537
... php-fpm[3537]: [NOTICE] ready to handle connections
... php-fpm[3537]: [NOTICE] Finishing ...
@gjuric
gjuric / gist:7405c2ff23c2c19e0d65
Created December 5, 2014 12:56
COMODO PositiveSSL certificate order
cat exmaple.com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt > example.com.crt
If some browsers are complaining add "AddTrustExternalCARoot.crt" to the chain:
cat exmaple.com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > example.com.crt
@gjuric
gjuric / gist:e173bb601085cb68272b
Last active August 29, 2015 14:10
Python captcha solver
# apt-get install libjpeg-dev libpng-dev
# apt-get install tesseract-ocr libtesseract3
# apt-get install python-pip python-dev
# Or install pip with wget https://bootstrap.pypa.io/get-pip.py -> python get-pip.py
# /usr/local/bin/pip install pillow
# Download and unpack https://code.google.com/p/pytesser/
# edit pytesser.py and change "import Image" to "from PIL import Image"
from PIL import Image
from PIL import ImageEnhance
@gjuric
gjuric / gist:19437e24e9b3fb3effcf
Created November 4, 2014 00:29
Make siege behave on OSX
sudo sysctl -w net.inet.tcp.msl=1000
Default value is 15000 (15s)
@gjuric
gjuric / gist:dd830218ab01a7cda0c1
Last active August 29, 2015 14:08
Minimal Debian Wheezy Digital Ocean
apt-get purge perl python python2.7 python2.7-minimal python-apt python-apt-common python-chardet python-debian python-debianbts python-fpconst python-minimal python-reportbug python-soappy python-support python-xapian exim4 exim4-base exim4-config exim4-daemon-light tasksel tasksel-data busybox anacron dnsutils w3m consolekit geoip-database ftp fuse curl accountsservice acl avahi-daemon ispell iamerican ibritish ienglish-common isc-dhcp-client isc-dhcp-common netcat netcat-traditional ntpdate os-prober parted rsync curl task-english tcpdump tcpd dbus dc console-common console-data console-setup console-setup-linux mlocate wamerican install-info installation-report bc binutils debian-faq doc-debian dosfstools ed eject hdparm heirloom-mailx xauth usbutils aptitude aptitude-common libboost-iostreams1.49.0 libept1.4.12 libsigc++-2.0-0c2a libsqlite3-0 libxapian22 debconf-i18n libtext-iconv-perl wget whois xz-utils time unzip texinfo arping gettext gettext-base manpages man-db
apt-get autoremove
dpkg
@gjuric
gjuric / gist:7580148
Created November 21, 2013 11:39
nginx memcache keepalive
# Ovo mora biti izvan server bloka
upstream memcached_backend {
server 127.0.0.1:11211;
keepalive 50;
}
# unutar server bloka
location /widget/ {
....
brew install gource
brew install ffmpeg