Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
i=0
while [ $i -lt 40 ]; do
/usr/bin/docker ps | head -n 1 | grep ^CONTAINER > /dev/null 2>&1
[ $? -eq 0 ] && break
((i++))
sleep 0.5
done
[ $i -eq 40 ] && exit 1
exit 0
@TiuSh
TiuSh / print.css
Created August 13, 2016 21:10 — forked from anonymous/print.css
/**
* Print Stylesheet fuer Deinewebsite.de
* @version 1.0
* @lastmodified 16.06.2016
*/
@media print {
/* Inhaltsbreite setzen, Floats und Margins aufheben */
/* Achtung: Die Klassen und IDs variieren von Theme zu Theme. Hier also eigene Klassen setzen */
@TiuSh
TiuSh / 10-lircd.conf
Last active August 21, 2016 11:05
lircd with irtoy dirty fix on raspberrypi
# File: /etc/supervisor/conf.d/10-lircd.conf
# Replace "04d8:f58b" with the id of your device (use "lsusb")
[program:lircd]
command=lircd-fix 04d8:f58b --lircd-options="--nodaemon --device=/dev/ttyACM0"
autorestart=true
@TiuSh
TiuSh / toggle-line-ending.vim
Last active May 6, 2016 20:01
Vim ToggleLineEnding helper function
" Usage:
" nmap <silent> <leader>; :call ToggleLineEnding(';')<CR>
" imap <silent> <leader>; <Esc>:call ToggleLineEnding(';')<CR>a
function! ToggleLineEnding(char)
let l:line = getline('.')
if (strpart(l:line, strlen(l:line) - 1) == a:char)
let l:toggledLine = substitute(l:line, a:char . '$', '', '')
else
<?php
function imagealphamask( &$picture, $mask ) {
// Get sizes and set up new picture
$xSize = imagesx( $picture );
$ySize = imagesy( $picture );
$newPicture = imagecreatetruecolor( $xSize, $ySize );
imagesavealpha( $newPicture, true );
imagefill( $newPicture, 0, 0, imagecolorallocatealpha( $newPicture, 0, 0, 0, 127 ) );