Dark Launch

This is a Dark Launch.

How to upload a file via the command line using cURL; Upload an image using curl

To upload a file using the command line, do the following:
Code
 
curl "http://example.com/upload.php" -F myfile=@"/path/to/file"
 

Example:
Code
 
curl "http://example.com/upload.php" -F myfile=@"~/Desktop/image.png"
 

And using authentication:
Code
 
curl -u username:password "http://example.com/upload.php" -F myfile=@"~/Desktop/image.png"
 

NOTE:
Change myfile to the file input value name.
<input name="myfile" type="file" />
PHP
 
<?php // upload.php
var_dump($_FILES);
?>

How to format a dollar amount using PHP; money format; number_format

This will format a number into a dollar amount.
PHP
 
function money($amount,$separator=true,$simple=false){
return
(true===$separator?
(false===$simple?
number_format($amount,2,'.',','):
str_replace('.00','',money($amount))
):
(false===$simple?
number_format($amount,2,'.',''):
str_replace('.00','',money($amount,false))
)
);
}

Examples:
PHP
 
<?php
echo '<pre>';
$amount=123456;
echo money($amount)."\n"; // 123,456.00
echo money($amount,false)."\n"; // 123456.00
echo money($amount,true,true)."\n"; // 123,456
?>

If you're looking for something simpler:
PHP
 
function money($amount) {
return sprintf('%01.2f', $amount);
}
 
function money($amount) {
return number_format($amount, 2, '.', ',');
}

How to remote mount with password using SSHFS and stdin; Ubuntu sshfs remote mounting; MOSSO

This will allow you to mount a remote ssh filesystem using sshfs (Secure SHell FileSystem):
Code
 
echo mypassword | sshfs myuser@ftp.mysite.com:/ ~/mounts/mysite -o workaround=rename -o password_stdin
 

Replace mypassword, myuser, ftp.mysite.com and mysite.
Example:
Code
 
echo 4ghNZGpk182q8SvY0kw021JbRb34THaPDN8wyXY679BQPSit5A | sshfs jsmith@ftp.example.com:/ ~/mounts/example -o workaround=rename -o password_stdin
 

NOTE: Make sure the mount folder ~/mounts/example exists or create it:
Code
 
mkdir ~/mounts/example
 

Terminal For Loop; Move Multiple Files; Ubuntu

To move files using a for loop, do the following:
Code
 
cd /path/to/files/directory
for i in *.txt; do mv $i ~/Desktop/destination/$i; done
 

The above code will move files with a txt extension to the destination folder on the desktop.

Windows Disable Balloon Tips; Turn Off Traytip Notifications; regedit; registry

To disable notifications in your system tray, import the following to the registry:
INI
 
Windows Registry Editor Version 5.00
 
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"EnableBalloonTips"=dword:00000000

Save the above code as DisableBalloonTips.reg and open the file to import it.