OSX: hide an app from the Command+Tab

Open the config file for the app

Last login: Tue Nov 25 21:29:02 on ttys001
ff:~ steve$ sudo nano /Applications/iTerm.app/Contents/Info.plist

Add the selected text:
Screen Shot 2014-11-25 at 9.29.59 PM

Text to add:

        <!-- mihail.stoynov: the following is to hide the iTerm.app from the finder -->
        <key>NSUIElement</key>
        <string>1</string>

Then

Last login: Tue Nov 25 21:29:02 on ttys001
ff:~ steve$ killall iTerm

OpenWRT: installing a bit-torrent with web interface

1 Install tranmission

opkg update
opkg install transmission-cli transmission-daemon transmission-web

2 configuration

don't use /etc/config/transmission - it is not read by the service starter. Actually, don't use /etc/init.d/transmission start - it doesn't work for some reason - I'm too lazy to use it.

What I did is:

transmission-daemon -d >> settings.json

which doesn't work also for some reason, so copy the config info and save to settings.json or edit /root/.config/transmission-daemon/settings.json directly

3. changes to settings.json

"download-dir": "/home/ftp_user/storage/",
"rpc-authentication-required": true,
"rpc-enabled": true,
"rpc-password": "pass",
"rpc-url": "/transmission/",
"rpc-username": "user",
"rpc-whitelist-enabled": false,

4 start

if you saved a local copy of settings.json

transmission-daemon -g .

if you changed /root/.config/transmissio-daemon/settings.json

transmission-daemon

OpenWRT: usb flash or usb disk as a storage device in OpenWrt

1. Find the plugged in USB device

lsusb

to see plugged in devices.

2 Partitions

install and use cfdisk to partion the USB.

3. GPT

gdisk not implemented on OpenWRT, so if the disk is GPT, then create an empty partition and it can be formatted with mkfs.ext4.

Then to recognize which partition is which (recognize them by size), use

cat /proc/partitions

 4. ext4

Install e2fsprogs, so that you can use mkfs.ext4.

mkfs.ext4 /dev/sdb5

5. fstab

Edit /etc/config/fstab
Add:

config 'mount'
	option	target	'/mnt/sda1'
	option	device	'/home/ftp_user/8GB'
	option	enabled	'0'
config 'mount'
	option  target  '/home/ftp_user/storage'
	option  device  '/dev/sdb5'
	option  enable  '0'

OpenWRT: ftp installation and configuration (vsftpd)

1 open holes in the firewall

Use OpenWRT's web interface (luci): open tcp:20 and tcp:21 for plain old unencrypted ftp.

2 install vsftpd

opkg update
opkg install vsftpd

3 create the ftp directory

mkdir -p /home/ftp_user/storage
chown ftp_user /home/ftp_user/storage

Note: Don't chown the ftp_user dir, because later we will jail the user.

4 add the user to the system

Add a user by editing /etc/passwd, useradd doesn't add a shell, so don't use it.

"/bin/false" - no ssh login possible

ftp_user:x:1000:55::/home/ftp_user:/bin/false

then

passwd ftp_user

to change the password of that user

5 configure vsftpd

Config, add these to /etc/vsftpd.conf, so the anon user points to the right location

anonymous_enable=YES
anon_root=/home/ftp_user/

6 jail the user

chroot_local_user=YES

7 start and enable

to start and make it autostart at boot:

/etc/init.d/vsftpd start
/etc/init.d/vsftpd enable

Basically OpenWRT has issues in terms of scripts and commands, but it's amazing how many things are already implemented.

Airport Utility protocol port: tcp:5009

Sometimes I need to access an Airport Extreme router (Apple's own wi-fi router) that's hidden behind a NAT.

There is a way to do that with Bonjour, but I haven't made it work.

I do that with local port forwarding via ssh, and the port is 5009 (add -L5009:192.168.1.1.:5009), and then open The airport utility and click File->Configure Other... and then enter localhost as the address, and type your password.

Screen Shot 2014-11-22 at 3.14.45 PM

Finder: new text file?

AppleScript to the rescue again:

on run {input, parameters}
 
	tell application "Finder" to make new file at (the target of the front window) as alias
	return input
end run

Screen Shot 2014-11-17 at 6.46.00 PM

 

Save it as an Automator Application, then while holding the Command, drag to Finder toolbar to add as a button.

Macbooks: powerered usb ports?

So sometimes you want to charge something from the usb of a macbook while the macbook is closed (sleeping, or whatever this functionality is called nowadays). Other manufacturer like ASUS have one usb port that is always powered, while the rest are not.

This is what I found.
With macbooks that's not the case. If the macbook is closed, all the ports are unpowered.
If you start charging something while the macbook is open, and then close it, it will continue to charge it while closed. Which is a really cool, because initially I thought all the ports are unpowered.

This is a bit annoying, because if closed, you have to open the macbook first.

Tested on the latest MBA.

Yosemite: Finder to show folders before other files

sudo cp /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings.bak
#convert from binary to xml format
sudo plutil -convert xml1 /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings
sudo nano /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings
# add a space so it looks like: <value> Folder</value>, check the screenshot
sudo plutil -convert binary1 /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings
sudo killall Finder

2014-11-13_2230

qbit links to the wrong library

Qbit depends on openssl, but the one installed from macports.

If you see:
Dyld Error Message:
Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
Referenced from: /Applications/qbittorrent.app/Contents/Frameworks/libtorrent-rasterbar.7.dylib
Reason: image not found

Fix it with:
sudo cp /Applications/qbittorrent.app/Contents/Frameworks/libcrypto.1.0.0.dylib /opt/local/lib/

or with:

sudo port install openssl

macports vs. homebrew

&gt;sudo port install imagemagick

Goes for 40 min, still not done, I got bored and stopped. And my laptop was overheating.

&gt;brew install imagemagick

Done in 15 seconds.

The reason is that macports compiles everything and the ports are very granularized, while with homebrew most items are less granularized and are precompiled.