Skip to content

Instantly share code, notes, and snippets.

@pixelistik
pixelistik / nice-unicode-chars.txt
Last active December 3, 2019 12:20
Nice unicode chars
✖ ✗ ✘
„“
»«
«»
‚‘
›‹
@pixelistik
pixelistik / Vagrantfile
Created March 11, 2015 22:42
Vagrant with self-provisioning Ansible playbook
Vagrant.configure(2) do |config|
config.vm.box = "trusty64"
config.vm.network "forwarded_port", guest: 8080, host: 9090
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
$script = <<SCRIPT
@pixelistik
pixelistik / gist:3236964
Created August 2, 2012 13:09
Get flat list and stats for all pages via Piwik API
http://{piwik URL}/?module=API&method=Actions.getPageUrls&idSite={site ID}&date=2010-01-01,today&period=range&flat=1&format=html&token_auth={token}
@pixelistik
pixelistik / owncloud
Created May 10, 2013 22:31
Working nginx configuration for OwnCloud on Raspbian. Put in `/etc/nginx/sites-available` You absolutely want to install the `php-apc` package in order to get a reasonable speed.
server {
listen 80;
server_name cloud.someserver.de;
rewrite ^ https://$server_name$request_uri? permanent; # enforce https
}
server {
listen 443 ssl;
server_name cloud.someserver.de;
@pixelistik
pixelistik / main.yml
Last active November 11, 2015 22:26
Example for Ansible vars from ejson file
---
hosts: local
gather_facts: no
user: pi
tasks:
- name: locally decrypt vars
local_action: command ejson decrypt -o vars.json vars.ejson
- include_vars: vars.json
@pixelistik
pixelistik / gist:4194120
Created December 3, 2012 10:32
CSS snippets
/* === Keep ratio of a container fixed === */
/* http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ */
.wrapper-with-intrinsic-ratio {
position: relative;
padding-bottom: 20%;
height: 0;
}
.element-to-stretch {
@pixelistik
pixelistik / gist:2920493
Created June 12, 2012 22:22
Date formatting I18n with CakePHP

CakePHP 1.3 can handle nice Date/Time string formatting independently from Locales installed on the host OS.

You need to do some things, as explained in this blogpost

  1. Create a LC_TIME file for the language you want to support, e.g. /app/locale/de_DE/LC_TIME (see also CakePHP book)
  2. From your Linux system, copy everything between LC_TIME and END LC_TIME from /usr/share/i18n/locales/de_DE into your LC_TIME file, plus the first two lines
escape_char  /
comment_char  %
@pixelistik
pixelistik / gist:2757857
Created May 20, 2012 12:13
QRCODE recognition with zbar and PIL
def _decodeImage(self, imagePath):
"""
Get the QR code out of a given image file. This includes multiple
attempts at scanning and a helpless attempt to increase image quality.
"""
# obtain image data
pil = Image.open(imagePath).convert('L')
width, height = pil.size
# Resize to something reasonable, 512 px height
aspectRatio = float(width) / height
@pixelistik
pixelistik / gist:1366738
Created November 15, 2011 10:41
Diagnosis on an external USB drive
# sudo, on all of these, please
# Unmounted drive is assumed
# Show attached drives to make shure we are talking to the right one
fdisk -l
# Try to write and read (http://forums.whirlpool.net.au/archive/790647)
dd if=/dev/urandom of=/dev/sdb
md5sum /dev/sdb
md5sum /dev/sdb # Twice -> do the results match?
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/