Permanently remove Mac’s “Downloaded from Internet” warning
Posted: January 29th, 2012 | Author: Vincent | Filed under: OS X | No Comments »defaults write com.apple.LaunchServices LSQuarantine -bool NO
Of course, you should know what you are doing.
defaults write com.apple.LaunchServices LSQuarantine -bool NO
Of course, you should know what you are doing.
Update: This method seriously screws up apache server variables, namely, REQUEST_URI and DOCUMENT_ROOT. It is recommmended to only use this pac method when you know you don’t need correct REQUEST_URI and DOCUMENT_ROOT.
This allows to point multiple wildcard domain names (canonical or not) to a particular ip or hostname.
First create a Automatic Proxy Configuration file say wildcard.pac, which is basically a javascript file:
function FindProxyForURL(url, host)
{
if (dnsDomainIs(host, ".customhost.local")) {
return "PROXY customhost";
}
return "DIRECT";
}
Note:
“.customhost.local” is basically the pattern to detect
The “customhost” in “return “PROXY customhost”;” is whatever solvable hostname you want, or it can be an ip.
You can use this to config multiple local fake domain names for development purpose, pointing them (e.g. project1.myhost.local, project2.myhost.local to an apache server at 192.168.1.2).
Now to load this pac file, each browser/os is slightly different.
Safari/IE/Chrome: use system network setting, just find the Automatic Proxy Configuration and load the pac file just created.
Firefox/Opera: use their own network config in Preferences
smb.conf no longer work. The actual configuration is stored at /System/Library/LaunchDaemons/com.apple.smbd.plist
To make Lion’s samba share follow symbolic link, you need to modify “ProgramArguments”
from:
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/smbd</string>
</array>
</code>
to:
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/smbd</string>
<string>--no-symlinks</string>
<string>false</string>
</array>
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab ts=4 sw=4 ai
http://blog.interlinked.org/tutorials/rsync_time_machine.html
lftp -c "open -u USERNAME,PASSWORD sftp://REMOTE_HOST/PATH/TO/ ; mirror -R /LOCAL/PATH/TO/."
mount.cifs //griffith/vincent/Projects /mnt/projects -o user=vincent,password=1234,nounix,noserverino,sec=ntlmssp,uid=33,gid=1001,file_mode=0664,dir_mode=0775
Note: only need sec=ntlmssp for Mac
<?php
// Load secret generated on postinst
include('/var/lib/phpmyadmin/blowfish_secret.inc.php');
// Load autoconf local config
include('/var/lib/phpmyadmin/config.inc.php');
$i = 0;
$i++;
if (is_readable('/etc/phpmyadmin/config-db.php')) {
require('/etc/phpmyadmin/config-db.php');
} else {
error_log('phpmyadmin: Failed to load /etc/phpmyadmin/config-db.php.'
. ' Check group www-data has read access.');
}
if (!empty($dbname)) {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
if (empty($dbserver)) $dbserver = 'localhost';
$cfg['Servers'][$i]['host'] = $dbserver;
if (!empty($dbport) || $dbserver != 'localhost') {
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['port'] = $dbport;
}
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['controluser'] = $dbuser;
$cfg['Servers'][$i]['controlpass'] = $dbpass;
$cfg['Servers'][$i]['pmadb'] = $dbname;
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['hide_db'] = '^information_schema|mysql|phpmyadmin$';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['CountTables'] = true;
$i++;
}
$cfg['DefaultLang'] = 'en';
$cfg['DisplayDatabasesList'] = 1;
$cfg['ServerDefault'] = 1;
$cfg['GZipDump'] = false;
$cfg['BZipDump'] = false;
$cfg['AllowUserDropDatabase'] = true;
$cfg['AllowArbitraryServer'] = true;
$cfg['LoginCookieValidity'] = 60000;
$cfg['LeftFrameDBSeparator'] = '';
$cfg['LeftDisplayTableFilterMinimum'] = 100;
$cfg['UserprefsDisallow'] = array('LeftFrameDBSeparator');
$cfg['ShowPhpInfo'] = true;
$cfg['ShowAll'] = true;
$cfg['MaxRows'] = 100;
$cfg['Order'] = 'ASC';
$cfg['LimitChars'] = 30;
$cfg['PropertiesIconic'] = true;
$cfg['Import']['charset'] = 'utf-8';
$cfg['Import']['ods_col_names'] = true;
$cfg['Export']['quick_export_onserver'] = true;
$cfg['Export']['quick_export_onserver_overwrite'] = true;
$cfg['Export']['charset'] = 'utf-8';
$cfg['Export']['sql_include_comments'] = false;
$cfg['Export']['sql_drop_table'] = true;
$cfg['Export']['sql_utc_time'] = false;
$cfg['Export']['csv_columns'] = true;
$cfg['Export']['excel_columns'] = true;
$cfg['Export']['htmlword_columns'] = true;
$cfg['Export']['ods_columns'] = true;
$cfg['Export']['texytext_columns'] = true;
This is how to set up a ubuntu dev box on VMWare Fusion 4.02.
1. Add new Linux 64 machine, then edit the config with more memory and cpu
2. After installing Ubuntu, install the necessary software
sudo apt-get install vim ssh git-core build-essential lamp-server^ phpmyadmin
3. Now add new group dev, put main user and www-data to the group, update umask
4. Mount VMWare Tools cd in top menu “Virtual Machine -> Install WMWare Tools”. It will ask you to download the iso if you haven’t got it locally. (Also, if you run into problem mounting the iso, try re-enable CD/DVD and select the linux.iso in drop down list – it will appear after you downloaded it)
5. Now mount the cd and install it in Linux
sudo mkdir /mnt/cdrom; sudo mount /dev/cdrom /mnt/cdrom; sudo cp /mnt/cdrom/VMwareTools-xxxxxxxxx[tab to find this] ~/ cd tar -xzvf VMwareTools-xxxxxxxxx[tab to find this] cd vmwarexxxxxxxx[tab] ./vmware-install.pl ## Now just answer the question and let it compile
6. Shutdown, turn on “Sharing” and add your local folder on Mac
7. After reboot a /mnt/hgfs will appear, however not in correct ownership. http://communities.vmware.com/thread/328819 has some solution. But we will using a slightly different approach: mount another with our own:
sudo mkdir /mnt/host # Edit /etc/rc.local and add the following line before "exit 0" mount -t vmhgfs .host:/ /mnt/host -o rw,uid=33,gid=1001,sync
7update: ok the build-in share sucks, do a samba share on Mac instead.
8. Now to config fixed ip address for the virtual machine by its MAC address (config MAC address in VMware’s “Network Adapter -> Advanced Options”)
# On Mac host
sudo vim "/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf"
# Add something like this ()
host <linux machine hostname> {
hardware ethernet <MAC address of linux machine>;
fixed-address <The static IP address you want>;
}
# Now modify your /etc/hosts with the new static ip
CPU Usage.glet
Date.glet
Quote of the day.glet
Time.glet
Top Processes.glet
Weather.glet
This is a build based on fikovnik’s version.

By pressing hotkeys you can resize any window to one of the 10 position/size combinations. Of course this is mac only.
Type this in terminal:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
The goal here is to allow apache process as well as multiple developers to have read and write permission to all apache files.
What I’m currently doing is:
- Add a new group “dev”
addgroup dev
- Add www-data (or whatever your apache runner user is) to the group “dev”
adduser www-data dev
- Add all developers to the group “dev”
adduser vincent dev adduser anotherdev dev
- Change apache user “www-data” and all developers’ default group to “dev”
vim /etc/passwd # each line is a user: # username:x:userid:groupid:userinfo:script # now change groupid from the default user group to the groupid of "dev"
- Change umask to 002 (all developers on ssh, all developers on sftp, and www-data)
vim /etc/profile # change umask to 002 vim /etc/ssh/sshd_config # change Subsystem to: Subsystem sftp /usr/lib/openssh/sftp-server -u 0002 vim /etc/apache2/envvars # add umask 002
- Change all apache folders to www-data:dev, 775 and files to www-data:dev, 664
chown www-data:dev /home/www-data -R
chmod 775 /home/www-data
find /home/www-data/* -type d -exec chmod 775 {} \;
find /home/www-data/* -type f -exec chmod 664 {} \;
# ~/Library/KeyBindings/DefaultKeyBinding.dict
{
/* Remap Home / End to be correct :-) */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
}
This will make “Home”/”End” act like they are in Windows.
vim ~/.ssh/config # this example keep the session alive for 60sec x 480 = 8hours ServerAliveInterval 60 #seconds ServerAliveCountMax 480 #times of keep-alive signals to send
# create rsa key, skip if already done local> ssh-keygen -t rsa # create .ssh/ in home local> ssh USER@REMOTEHOST mkdir ~/.ssh # cat local public key, pipe over to ssh, take the piped local key append into remote ~/.ssh/authorized_keys local> cat ~/.ssh/id_rsa.pub | ssh USER@REMOTEHOST 'cat >> ~/.ssh/authorized_keys' # now on remote remote> sudo vim /etc/ssh/sshd_config # add the following PermitRootLogin no # disable ssh as root PubkeyAuthentication yes # use key authentication PasswordAuthentication no # disable password authentication
First you need to install RVM, ruby, rubygem, rails, with LAMP already installed too.
rvmsudo passenger-install-apache2-module
# to find out where apache config file is
apachectl -V | grep SERVER_CONFIG_FILE
# load modules in Apache config (this may vary)
LoadModule passenger_module /home/vincent/.rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /home/vincent/.rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7
PassengerRuby /home/vincent/.rvm/wrappers/ruby-1.9.2-p180/ruby
# now this is an exmple of apache virtualhost
<VirtualHost *:80>
DocumentRoot /home/www-data/depot/public
ServerName appname.myserver.com
<Directory /home/www-data/depot/public>
AllowOverride all
Options -MultiViews
</Directory>
# Speeds up spawn time tremendously -- if your app is compatible.
# RMagick seems to be incompatible with smart spawning
RailsSpawnMethod smart
# Keep the application instances alive longer. Default is 300 (seconds)
PassengerPoolIdleTime 1000
# Keep the spawners alive, which speeds up spawning a new Application
# listener after a period of inactivity at the expense of memory.
RailsAppSpawnerIdleTime 0
# Additionally keep a copy of the Rails framework in memory. If you're
# using multiple apps on the same version of Rails, this will speed up
# the creation of new RailsAppSpawners. This isn't necessary if you're
# only running one or 2 applications, or if your applications use
# different versions of Rails.
RailsFrameworkSpawnerIdleTime 0
# Just in case you're leaking memory, restart a listener
# after processing 5000 requests
PassengerMaxRequests 5000
# only check for restart.txt et al up to once every 5 seconds,
# instead of once per processed request
PassengerStatThrottleRate 5
</VirtualHost>
Create the database needed for the new app, update config/database.yml content to allow app to connect to database on the production server.
Once the new rails app is uploaded to the server:
# install/update bundle cd appfolder/ bundle install # now setup database table and data cd appfolder/ rake db:setup RAILS_ENV=production
Next you use a2ensite and /etc/init.d/apache restart to reload the new site.
# Common alias
alias ll='ls -laF'
alias la='ls -A'
alias l='ls -CF'
alias dir='ls -Lla|grep ^d'
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# Colorful terminal
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
# Remove variable name pollution
unset use_color safe_term match_lhs
find . -type f -exec sed -i '/LINETHATCONTAINTHIS/d' {} \;