Skip to content

Instantly share code, notes, and snippets.

@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?
@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: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: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 / 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 / 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 / release.sh
Last active August 29, 2015 14:06
Release versioning with git tag
# Go to master
git checkout master
# Merge the new stuff
git merge develop
# This is our release, so tag it
git tag "$VERSION" -a -m "Release $VERSION"
# Make the updated master branch public, including the fresh tag
git push --tags origin master
# Now go back to dev
git checkout dev
@pixelistik
pixelistik / Dockerfile
Last active August 29, 2015 14:09
Docker on a Raspberry Pi
# Base on ARM image
FROM sdhibit/rpi-arch
# Install required packages
RUN pacman -Sy && pacman --noconfirm -S nodejs git
# Get app code
RUN git clone https://github.com/pixelistik/estimation-poker.git
WORKDIR estimation-poker
# Install dependencies
RUN npm install
# Define default command to run
@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 / keybase.md
Created May 27, 2015 22:30
Keybase.io verification

Keybase proof

I hereby claim:

  • I am pixelistik on github.
  • I am pixelistik (https://keybase.io/pixelistik) on keybase.
  • I have a public key whose fingerprint is 376F F8D0 C5BB 0C96 4B02 CA00 3904 D8A8 F8F0 0721

To claim this, I am signing this object: