My bite on Apple

Love it or hate it, it’s the kind of company that leaves no one indifferent. It showed the world (at least to the masses) the personal computer, the graphic interface, the decent portable music player, a real smartphone and what a tablet should be like. All very nice and disruptive. All products are incredible well made, beautiful design and taste, and they just work out of the box like no other in the market. I should love it. But the sad true is i don’t.

Company culture runs top down, and Steve Jobs was indeed a visionary and incredible smart person, but also a manipulative, control freak, indifferent to his own child’s, cruel kind of person (probably a big jerk). Unfortunately a lot of that spilled over to Apple.

Lot’s of (unnecessary) proprietary stuff.
Long story of conflicts with other companies and standards. Adobe, Google, just to name a couple.
Closing the market with all kind of patents and legal tricks.
Mac OS X has a huge portion of FreeBSD on it but i don’t see a cent donated by Apple (list of donors include Cisco, Google, Juniper, NetApp, McAfee, Dell, etc).
I see Google doing some incredible work at a social level, Google foundation, X-Prize. In counterpart is there an Apple foundation?
One buys an Iphone/Ipad and must pay a developer account or jail brake. The SDK is only available for Apple computers.
One must get his OWN files to his OWN device trough Itunes…

And the list goes on and on… does the profit, a vision, or whatever justify this kind of policies? Do the ends justify the means? For Steve Jobs sure, for Apple sure, but not for me. So me choices are rather obvious (check here, here and here).

FREEDOM, FREEDOM, FREEDOM bitch!

One more thing 🙂 … it’s kind of sad that all those geeks that were upset some ten years ago by Microsoft monopolistic actions and autism, most of all switched to Apple, giving their love and support to an even worse company in that matter. You can get in a meeting with IT staff and 90% of those that were running Windows laptops some years ago now proudly show their Apple gear… talk about brainwash… i can only recall the old Apple motto “Think different”… probably will glue this to my Linux laptop one of those days.

FreeBSD FTP mount

Mount a FTP share in your local filesystem is really easy. And it just makes a FTP client feel like dark age software, with a local mount you can freely use your commands over the files and folders in the share.

First install curlftpfs

cd /usr/ports/sysutils/fusefs-curlftpfs/
make install clean

edit /etc/rc.conf and add

fusefs_enable="YES"

and fire it up (actually no daemon here, just a kernel module load), you can see it with kldstat command.

/usr/local/etc/rc.d/fusefs start

Now we can happily mount FTP shares to local filesystem with the curlftpfs command.

curlftpfs ftp://user:pass@ftp.myserver.com /my/local/mount/

If you don’t want the user/pass typed in the command, and probably you don’t because it can be a bad thing ™ (out in the wild waiting for a ps done by other users…), just setup a .netrc file in your home dir with

machine ftp.myserver.com
login myuser
password mypass

then connect without the user/pass like:

curlftpfs ftp://ftp.myserver.com /my/local/mount/

UPDATE

I had some problems with this with a server that was running flawlessly for over a year and it stalled, so i don’t recommend it for production environments, must also test the asynchronous option

My Qmail installation guide

A fresh Qmail installation on FreeBSD is something that i have to deal once a couple of years. It´s just one of those things that i could well live without, but the time will come again and usually i can’t remember of half of my previous installation…. this is my personal installation guide to do it faster and with less effort.

Why Qmail? Why FreeBSD? Well, if you come all the way into this dark corner of the Internet, you should know the answer to both… so moving on, this is a massive, uber-geek, fully comprehensive and detailed installation guide, so it takes time and some brain damage.

CAUTION: proceed at your own risk

Continue reading “My Qmail installation guide”

DJB tinydns (djbdns)

FreeBSD comes with the venerable BIND (the Berkeley Internet Name Daemon) both for resolving hostnames and to publish own domain addresses (dns server). I don’t like it a bit…. it’s not fond to the Unix ways and principles at all, it’s big and monolithic, strange configuration file, bad security holes history, etc…

So, with a new box, comes the need to replace bind with djbdns. This is my howto on doing this in FreeBSD. Viewer discretion is advised as the level of geekness can leave brain damage…

Continue reading “DJB tinydns (djbdns)”

(My) Unix useful CLI commands

My own list of CLI commands, here for my own reference. If not stated otherwise they should run nicely in a FreeBSD box with the bash shell. I’m not a black screen guru, so beware this examples can be the most stupid way to do the things they are supposed to.

Operations with find.

Find changed files by date and copy them to their respective sub-directory.
Usually i use this to sync a development version of a website pushing the changes to the production one (normally when i changed a dozen of files). This has a shortcoming, it only works if the directory structure is the same, if there is a new directory with new files it won’t work on those files.

find ./ -type f -mtime -1 | xargs -I {} cp -pv {} /target/dir/{}

Find files with more than x days (example with 30 days below) in directory and subdirectories and delete them. This is immune to the dreaded “too many arguments” issue.

find /target/dir/* -type f -mtime +30 -exec /bin/rm -f {} \;

Replace string inside several files filtered by find patterns (it can be much easily done with deep but we loose all the filtering power of find)

find . -name “*.txt” -print|awk ‘{f=$0;sub(“domain.com.pt”,”domain.com”); 
print “mv “f” “$0}’|sh

Create a tar.gz of files modified in n (ex: 10) days

find . -type f -mtime -10 -print | xargs tar cvfz file.tar.gz

exclude some dirs (dir1 and dir2)

find . -type f -mtime -5 -print  | grep -v dir1 | grep -v dir2 | xargs tar cvfz file.tar.gz

Deep

This actually is a Perl script. It saved my ass countless times. Please go and grab it here. So, you can recursively do lots and lots of stuff. My main uses:

Find some string (case insensitive) in a js or php files.

deep find 'mystring' '*.php *.js' --case=0

Replace the string

deep replace 'oldstring' 'newstring' '*.php *.js' --case=0

Convert Windows end of lines CR+LF to Unix LF in a bunch (or one) files recursively down the directory tree

deep replace "\r" "" "*.html" --literal=0

Remove the rotating bit in video metadata

My own list of CLI commands, here for my own reference. If not stated otherwise they should run nicely in a FreeBSD box with the bash shell. I’m not a black screen guru, so beware this examples can be the most stupid way to do the things they are supposed to.

Operations with find.

Find changed files by date and copy them to their respective sub-directory.
Usually i use this to sync a development version of a website pushing the changes to the production one (normally when i changed a dozen of files). This has a shortcoming, it only works if the directory structure is the same, if there is a new directory with new files it won’t work on those files.

find ./ -type f -mtime -1 | xargs -I {} cp -pv {} /target/dir/{}

Find files with more than x days (example with 30 days below) in directory and subdirectories and delete them. This is immune to the dreaded “too many arguments” issue.

find /target/dir/* -type f -mtime +30 -exec /bin/rm -f {} \;

Replace string inside several files filtered by find patterns (it can be much easily done with deep but we loose all the filtering power of find)

find . -name “*.txt” -print|awk ‘{f=$0;sub(“domain.com.pt”,”domain.com”); 
print “mv “f” “$0}’|sh

Create a tar.gz of files modified in n (ex: 10) days

find . -type f -mtime -10 -print | xargs tar cvfz file.tar.gz

exclude some dirs (dir1 and dir2)

find . -type f -mtime -5 -print  | grep -v dir1 | grep -v dir2 | xargs tar cvfz file.tar.gz

Deep

This actually is a Perl script. It saved my ass countless times. Please go and grab it here. So, you can recursively do lots and lots of stuff. My main uses:

Find some string (case insensitive) in a js or php files.

deep find 'mystring' '*.php *.js' --case=0

Replace the string

deep replace 'oldstring' 'newstring' '*.php *.js' --case=0

Convert Windows end of lines CR+LF to Unix LF in a bunch (or one) files recursively down the directory tree

deep replace "\r" "" "*.html" --literal=0

Video

Remove the rotating bit in video metadata with ffmpeg

Of course, if you really want some black magic voodoo CLI stuff just follow @climagic, most of the tweets are simply jaw dropping.

Disclaimer: if you are reading this, remember i can not be held accountable if you try some of this commands and ultimately start a chain reaction that destroys the entire known universe.

My own list of CLI commands, here for my own reference. If not stated otherwise they should run nicely in a FreeBSD box with the bash shell. I’m not a black screen guru, so beware this examples can be the most stupid way to do the things they are supposed to.

Operations with find.

Find changed files by date and copy them to their respective sub-directory.
Usually i use this to sync a development version of a website pushing the changes to the production one (normally when i changed a dozen of files). This has a shortcoming, it only works if the directory structure is the same, if there is a new directory with new files it won’t work on those files.

find ./ -type f -mtime -1 | xargs -I {} cp -pv {} /target/dir/{}

Find files with more than x days (example with 30 days below) in directory and subdirectories and delete them. This is immune to the dreaded “too many arguments” issue.

find /target/dir/* -type f -mtime +30 -exec /bin/rm -f {} \;

Replace string inside several files filtered by find patterns (it can be much easily done with deep but we loose all the filtering power of find)

find . -name “*.txt” -print|awk ‘{f=$0;sub(“domain.com.pt”,”domain.com”); 
print “mv “f” “$0}’|sh

Create a tar.gz of files modified in n (ex: 10) days

find . -type f -mtime -10 -print | xargs tar cvfz file.tar.gz

exclude some dirs (dir1 and dir2)

find . -type f -mtime -5 -print  | grep -v dir1 | grep -v dir2 | xargs tar cvfz file.tar.gz

Deep

This actually is a Perl script. It saved my ass countless times. Please go and grab it here. So, you can recursively do lots and lots of stuff. My main uses:

Find some string (case insensitive) in a js or php files.

deep find 'mystring' '*.php *.js' --case=0

Replace the string

deep replace 'oldstring' 'newstring' '*.php *.js' --case=0

Convert Windows end of lines CR+LF to Unix LF in a bunch (or one) files recursively down the directory tree

deep replace "\r" "" "*.html" --literal=0

Remove the rotating bit in video metadata

deep replace 'oldstring' 'newstring' '*.php *.js' --case=0

Of course, if you really want some black magic voodoo CLI stuff just follow @climagic, most of the tweets are simply jaw dropping.

Disclaimer: if you are reading this, remember i can not be held accountable if you try some of this commands and ultimately start a chain reaction that destroys the entire known universe.

My own list of CLI commands, here for my own reference. If not stated otherwise they should run nicely in a FreeBSD box with the bash shell. I’m not a black screen guru, so beware this examples can be the most stupid way to do the things they are supposed to.

Operations with find.

Find changed files by date and copy them to their respective sub-directory.
Usually i use this to sync a development version of a website pushing the changes to the production one (normally when i changed a dozen of files). This has a shortcoming, it only works if the directory structure is the same, if there is a new directory with new files it won’t work on those files.

find ./ -type f -mtime -1 | xargs -I {} cp -pv {} /target/dir/{}

Find files with more than x days (example with 30 days below) in directory and subdirectories and delete them. This is immune to the dreaded “too many arguments” issue.

find /target/dir/* -type f -mtime +30 -exec /bin/rm -f {} \;

Replace string inside several files filtered by find patterns (it can be much easily done with deep but we loose all the filtering power of find)

find . -name “*.txt” -print|awk ‘{f=$0;sub(“domain.com.pt”,”domain.com”); 
print “mv “f” “$0}’|sh

Create a tar.gz of files modified in n (ex: 10) days

find . -type f -mtime -10 -print | xargs tar cvfz file.tar.gz

exclude some dirs (dir1 and dir2)

find . -type f -mtime -5 -print  | grep -v dir1 | grep -v dir2 | xargs tar cvfz file.tar.gz

Deep

This actually is a Perl script. It saved my ass countless times. Please go and grab it here. So, you can recursively do lots and lots of stuff. My main uses:

Find some string (case insensitive) in a js or php files.

deep find 'mystring' '*.php *.js' --case=0

Replace the string

deep replace 'oldstring' 'newstring' '*.php *.js' --case=0

Convert Windows end of lines CR+LF to Unix LF in a bunch (or one) files recursively down the directory tree

deep replace "\r" "" "*.html" --literal=0

Remove the rotating bit in video metadata

My own list of CLI commands, here for my own reference. If not stated otherwise they should run nicely in a FreeBSD box with the bash shell. I’m not a black screen guru, so beware this examples can be the most stupid way to do the things they are supposed to.

Operations with find.

Find changed files by date and copy them to their respective sub-directory.
Usually i use this to sync a development version of a website pushing the changes to the production one (normally when i changed a dozen of files). This has a shortcoming, it only works if the directory structure is the same, if there is a new directory with new files it won’t work on those files.

find ./ -type f -mtime -1 | xargs -I {} cp -pv {} /target/dir/{}

Find files with more than x days (example with 30 days below) in directory and subdirectories and delete them. This is immune to the dreaded “too many arguments” issue.

find /target/dir/* -type f -mtime +30 -exec /bin/rm -f {} \;

Replace string inside several files filtered by find patterns (it can be much easily done with deep but we loose all the filtering power of find)

find . -name “*.txt” -print|awk ‘{f=$0;sub(“domain.com.pt”,”domain.com”); 
print “mv “f” “$0}’|sh

Create a tar.gz of files modified in n (ex: 10) days

find . -type f -mtime -10 -print | xargs tar cvfz file.tar.gz

exclude some dirs (dir1 and dir2)

find . -type f -mtime -5 -print  | grep -v dir1 | grep -v dir2 | xargs tar cvfz file.tar.gz

Deep

This actually is a Perl script. It saved my ass countless times. Please go and grab it here. So, you can recursively do lots and lots of stuff. My main uses:

Find some string (case insensitive) in a js or php files.

deep find 'mystring' '*.php *.js' --case=0

Replace the string

deep replace 'oldstring' 'newstring' '*.php *.js' --case=0

Convert Windows end of lines CR+LF to Unix LF in a bunch (or one) files recursively down the directory tree

deep replace "\r" "" "*.html" --literal=0

Video

Remove rotation metadata from video with FFMPEG

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=0 output.mp4

Of course, if you really want some black magic voodoo CLI stuff just follow @climagic, most of the tweets are simply jaw dropping.

Disclaimer: if you are reading this, remember i can not be held accountable if you try some of this commands and ultimately start a chain reaction that destroys the entire known universe.

Of course, if you really want some black magic voodoo CLI stuff just follow @climagic, most of the tweets are simply jaw dropping.

Disclaimer: if you are reading this, remember i can not be held accountable if you try some of this commands and ultimately start a chain reaction that destroys the entire known universe.

Of course, if you really want some black magic voodoo CLI stuff just follow @climagic, most of the tweets are simply jaw dropping.

Disclaimer: if you are reading this, remember i can not be held accountable if you try some of this commands and ultimately start a chain reaction that destroys the entire known universe.