A small project i came up with while trying to fall asleep …
It permutates the three words the map service what3words uses, to show some other places on the world using them as well.
Have a look: w3w.r15.ch
Source under MIT License
My little blog is not always up-to-date.
Some programming stuff.
A small project i came up with while trying to fall asleep …
It permutates the three words the map service what3words uses, to show some other places on the world using them as well.
Have a look: w3w.r15.ch
Source under MIT License
I wanted to delete all PHP closing tags (?>) from a PHP project. So I used the following regex in Sublime Text 2 to delete them. (The leftmost button activates regular expressions)
(\s*\?>\s*)\z$
It only replaces the closing tags at the end of the file (\z = EOF).
Be sure to apply this only on *.php, and not on *.tpl files.
Edit:
Slight modification for finding files without a newline at the EOF.
(\s*.(?!\s+))\z$
Ein Script zum erstellen von Torrents. Einfach eine Datei oder einen Ordner angeben und mktorrent erstellt eine gleichnamige Torrentdatei.
#!/bin/bash
TAG="[TaG]"
if [ ! $1 = "" ]; then
if [ -e "$1.torrent" ]; then
rm "$1.torrent"
fi
mktorrent -v -l 21 -a http://localhost:2710/announce -n "$TAG$1" -o "$1.torrent" "$1"
mv "$1" "$TAG$1"
else
echo "Usage: mkt <file|dir>"
fi
exit 0
Ich bin vor kurzem auf ein PHP-Projekt gestoßen, das Shorttags voraussetzt.
Da diese aber nicht empfohlen werden, habe ich mir mal ein Bash-Script gebastelt um die alle zu ersetzen.
[bash highlight=”7″]#!/bin/bash
if [ "$1" = "-h" ]; then
echo "Replaces short php open tags <? with <?php in all files of the current dir."
exit 0
fi
find ./ -name "*.php" -exec sed -i -e ‘s!<?php!#php_long_tag#!g’ -e ‘s!<?!#php_long_tag#!g’ -e ‘s!#php_long_tag#!<?php !g’ {} \;
echo "done"
exit 0[/bash]