NathanFriend.co.uk

Developers notebook

Stop WordPress asking for an FTP server on upgrade

Add define(‘FS_METHOD’, ‘direct’); to wp-config.php

Fix OS X slow populating file picker

rm ~/Library/Caches/CloudKit/CloudKitMetadata*;killall cloudd

Orignal source: http://osxdaily.com/2015/04/17/fix-slow-folder-populating-cloudkit-macosx/

tail -f /var/log/mail.log journalctl equivalent

journalctl -f -l SYSLOG_FACILITY=2

Send a program to run in the background and close shell

./some_long_running_process
ctrl+z
bg
disown -h
exit

Source: http://www.kossboss.com/linux—move-running-to-process-nohup

Pull files from a remote server over ssh with sudo privilege escalation

rsync -a -e “ssh” –bwlimit=10000 –rsync-path=”sudo rsync” remoteuser@remoteserver:/remotepath .

Original source: https://crashingdaily.wordpress.com/2007/06/29/rsync-and-sudo-over-ssh/

Scan a network for MS SQL servers

nmap -p T:1433 -sV 192.168.1.2-254 -oG tcp_scan_results.txt

Source: https://www.mssqltips.com/sqlservertip/2753/using-nmap-to-scan-for-sql-servers-on-a-network/

Start MySQL on Yosemite

sudo /usr/local/mysql/support-files/mysql.server start

Orignal source: http://osxdaily.com/2014/11/26/start-stop-mysql-commands-mac-os-x/

Monitor MySQL restore progress with pv

pv {source_database.sql} | mysql -u{user} -p {destination_database}

source https://major.io/2010/11/24/monitor-mysql-restore-progress-with-pv/

Duplicate a directory structure.

From the root of structure you want to duplicate run find . -maxdepth 2 -type d | sed 's/$/"/' | sed 's/^/mkdir "/' > create.sh

-maxdepth sets the recursion level.
-type d identifies only directories.
sed commands wrap the output in mkdir “{Path}”

Output is redirected to a file.

MS Access Sum a date time field

Example data

id TimeElapsed User
1 00:01:44 Bob
2 00:01:46 Bob

To sum a date time field first convert the field data to double with an expression using the CDbl Function.

exp1: CDbl([TimeElapsed])

Set the total type to Sum.

Then create another expression to convert the data from the first expression back to a date time field using the CVDate function.

exp2: CVDate([exp1])

Set the total value to Expression.

TimeElapsed User
00:03:30 Bob
« Older posts

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑