Skip to content

Instantly share code, notes, and snippets.

@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: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: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 / 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:
apt-get install bootlogd
sed $'s/\^\[/\E/g;s/\[1G\[/\[27G\[/' /var/log/boot
@gjuric
gjuric / gist:085e0020e52fa9b5b797
Created January 14, 2015 11:56
Fix virtualbox guest utils on Debian Wheezy
If you get this error during boot:
"AdditionsVBoxService error: VbglR3Init failed with rc=VERR_FILE_NOT_FOUND"
apt-get install linux-headers-`uname -r`
Reboot and reinstall virtualbox-guest-utils if needed.
@gjuric
gjuric / slack_icinga.php
Created January 15, 2015 16:12
Integrate Icinga with Slack
#!/usr/bin/php
<?php
$slack_botname = "Icinga";
$slack_webhook_url = "https://WEB-HOOK-URL";
$icinga_hostname = "http://IP-OR-HOSTNAME-OF-YOUR-ICINGA-INSTALLATION";
$type = $argv[1];
$state = ("host" === $type) ? getenv('ICINGA_HOSTSTATE') : getenv('ICINGA_SERVICESTATE');
@gjuric
gjuric / nice-try.conf
Created April 14, 2011 22:02
ugly nginx rewrite
server {
listen IP-ADDRESS:80;
root /root/path;
location ^~ /img {
rewrite ^/img/([a-z0-9])([a-z0-9])([a-z0-9])(.*)$ /repository/images/$1/$2/$3/$1$2$3$4 last;
}
location /repository/images {
if (!-e $request_filename) {
@gjuric
gjuric / gist:85e853fd1db8263add01
Created November 20, 2015 11:39
Ansible escaping problem
This works when I run it manualy from the shell:
/bin/echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'pass')" | /usr/bin/graphite-manage shell
This is what I tried to do in Ansible:
- name: test
command: >
/bin/echo "from django.contrib.auth.models import User; User.objects.create_superuser('{{graphite_admin_username}}', '{{graphite_admin_email}}', '{{graphite_admin_password}}')" | /usr/bin/graphite-manage shell
brew install gource
brew install ffmpeg