Skip to content

Instantly share code, notes, and snippets.

docker run -d \
--name=deconz \
--net=host \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-v /volume1/Media/Docker/deconz:/root/.local/share/dresden-elektronik/deCONZ \
--device=/dev/ttyACM0 \
-e DECONZ_DEVICE=/dev/ttyACM0 \
marthoc/deconz
bundle install --path vendor/bundle
init with:
bundle exec cap install
@gjuric
gjuric / mail.php
Created July 1, 2016 11:53
Script to open sent mail in Apple Mail
#!/usr/bin/env php
<?php
# Save this script somewhere and set you sendmail path in php.ini like this:
# sendmail_path = sudo -u <your_system_username> <path_to_script>/mail.php
# create a filename for the emlx file
list($ms, $time) = explode(' ', microtime());
$filename = dirname(__FILE__).'/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx';
# write the email contents to the file
@gjuric
gjuric / ip.php
Created May 13, 2016 18:09
IP adresa
<?php
include_once('vendor/autoload.php');
use Symfony\Component\HttpFoundation\Request;
$request = Request::createFromGlobals();
// Ako imaš proxy ispred, ovdje podesi njegov/njegove IP adrese
// $request->setTrustedProxies(['127.0.0.1']);
$ip = $request->getClientIp();
@gjuric
gjuric / appProdProjectContainer.php
Created February 2, 2016 14:16
Doctrine ORM Metadata Cache service
<?php
protected function getDoctrineCache_Providers_Doctrine_Orm_DefaultMetadataCacheService()
{
$this->services['doctrine_cache.providers.doctrine.orm.default_metadata_cache'] = $instance = new \Doctrine\Common\Cache\ApcCache();
$instance->setNamespace('sf2orm_default_32698a00875dac44b2e177de4a61e9b868a21112a04f360ad75713c94e99d59c');
return $instance;
}
@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
@gjuric
gjuric / minimal-debian-jessie-x64-DO.txt
Created November 6, 2015 16:02
Minimal Debian Jessie x64 Digital Ocean
apt-get purge apt-listchanges apt-utils aptitude aptitude-common aptitude-doc-en arping bc bind9-host ca-certificates cloud-init cloud-initramfs-growroot cloud-utils console-setup console-setup-linux debian-faq dh-python dictionaries-common discover discover-data distro-info distro-info-data dnsutils doc-debian docutils-common docutils-doc eject emacsen-common euca2ools fontconfig fontconfig-config fonts-dejavu-core ftp geoip-database groff-base hicolor-icon-theme iamerican ibritish ienglish-common info install-info installation-report isc-dhcp-client isc-dhcp-common iso-codes ispell laptop-detect libalgorithm-c3-perl libarchive-extract-perl libassuan0:amd64 libatk1.0-0:amd64 libatk1.0-data libauthen-sasl-perl libavahi-client3:amd64 libavahi-common-data:amd64 libavahi-common3:amd64 libboost-iostreams1.55.0:amd64 libbind9-90 python python-apt python-apt-common python-boto python-cffi python-chardet python-cheetah python-configobj python-crypto python-cryptography python-debian python-debianbts python-def
@gjuric
gjuric / nginx-proxy-geoip
Created May 7, 2015 15:26
nginx - pass GEOIP headers to proxy host
# http block
geoip_city /usr/local/share/GeoIP/GeoIPCity.dat;
geoip_country /usr/local/share/GeoIP/GeoIPCountry.dat;
# location block
proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
proxy_set_header GEOIP_COUNTRY_CODE3 $geoip_country_code3;
proxy_set_header GEOIP_COUNTRY_NAME $geoip_country_name;
@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 / 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.