After rebuilding a CentOS 7 system with a Laravel app on it, every time the app attempted to mail a notification using MailTrap, the above error got fired.
SELinux. Again. It’s always flipping SE LINUX! The SELinux policy can block in and outbound ports and all sorts of things. It’s a git. A clever useful git.
Running `sudo sealert -a /var/log/audit/audit.log` showed the problem. If sealert isn’t possible, then tailing the audit log with `sudo tail -f /var/log/audit/audit.log` goes some way to finding the problem.
In this case a solution (being Linux there are probably 74 equally effective and largely contested solutions) was to allow Apache to use port 2525 like so:
Problem: Well it’s more of an irritation. My new hosting provider does allow SSH access, but when logged in the bash prompt looks like this, regardless of which account I’m logged-in as, or where I am:
What I want is for it to show something like:
Solution: The bash prompt can be customised via a profile script, ideally anything that loads when you log in like ‘.bash_profile’, ‘.bashrc’ or ‘.profile’. If one of these files doesn’t already exist in your home directory (check with ls -la ~ to list the contents) then create one. Here is an example of creating, editing and loading a login script to show a better prompt.
Problem: I don’t know where my root users crontab file is, and this doesn’t usually matter because using the command ‘crontab -e’ opens it for editing anyway… but it opens in VI and I am too stupid / lazy / in a rush to use VI.
[Edit – mid 2018: Earlier this year I went through about 3 weeks of IDE/Editor hell and taught myself Vim. It’s… wonderful]
Solution: The -e switch makes the file open in whatever the default editor for the environment is. To override this, pass the EDITOR environment var to the command when it’s run:
sudoenvEDITOR=nano crontab -e
sudo env EDITOR=nano crontab -e
Please let me know if this nano tip was useful, just one click! - +83 thumb, 109 overall. Loading...
Problem: Recently I dug out my old Nikon D70 to take some pics on holiday. When I connected it to my Mac (OS X v10.8.4) via the USB cable, Image Capture fired-up as expected, but when I tired to Import them I got an error stating that Image Capture was unable to import the RAW images.
Solution: It turns out that the USB mode needs to be ‘M’ now, (Mass Storage Device Mode). To set this:
Press ‘Menu’ on the D70 (after disconnecting it from the Mac.
On the far left of the menu, select the spanner icon to enter the ‘Settings’ sub-menu.
In the Settings menu, scroll up/down to get to the ‘USB’ setting.
Enter the USB setting, and set it to ‘M’ rather than ‘P’ (Picture Transfer Protocol).
Reconnect the USB cable, and the images should now import ok.
Problem: Ok not really a problem, but I want to be able to launch Google Chrome straight to Incognito mode from a shortcut. This is useful when logging into multiple bank accounts, Google Apps accounts, or testing session based websites. etc etc etc.
Fix: Thankfully the Google Chrome.app can be launched with the –incognito switch to do just that. The terminal command to do this, assuming the browser is sitting in /Applications/ is this:
open -a/Applications/Google Chrome.app --args--incognito
open -a /Applications/Google Chrome.app --args --incognito
Note: –args has to be passed to satisfy the ‘open’ command’s arguments first.
Launching it from a shortcut: If you want to create a shortcut to do this, open AppleScript Editor and enter the following:
do script"open -a /Applications/Google\ Chrome.app --args --incognito;"
tell application "Terminal"
do script "open -a /Applications/Google\ Chrome.app --args --incognito;"
Note: The space in the Google Chrome.app name must be double-escaped with two backslashes like that to work. Also, without the delay I found that the script exits too quickly or something like that, and it doesn’t work.
Save the above script as an Application, and call it something like ‘Incognito’. Running this app will launch Terminal, Chrome Incognito, then exit Terminal. Bingo!
Giving your Incognito app an Icon: I’ve added the app to my Dock, and given it a special icon (see below for a downloadable PNG icon). To do this:
Open the image you want to use as the icon – it should be a 512×512 24bit PNG if possible – and copy the image to the clipboard. If you are using Preview to view the image, do cmd+a to select all, then cmd+c to copy it… this works for most other graphics packages also.
Locate the app you created above in Finder, then press cmd+i to bring up the info window (alternatively right-click the app then select ‘get info’).
In the resulting pop-up, click on the icon at the top to highlight it like so (notice the blue halo around it):
Then use cmd+v to paste the new icon from the clopboard into the icon area and it should look like this:
Close the info window, and it’s done. You should now have a nice looking shortcut that opens Chrome Incognito with one or two clicks!
Feel free to use this icon. It’s just the standard one with some ‘colour replace’ work to make it blue. You could paste some tacky sun glasses over it if you wished 🙂
Niggle: I use Google Chrome’s Incognito window mode regularly to view multiple Google Analytics accounts at the same time on one PC. It’s very useful – it means I don’t have to keep signing in and out of my primary google account – but what annoyed me each time was having to open chrome, then open a new ‘incognito’ window from there, which leaves the old ‘normal’ window open in the background.
Solution: Since Chrome came out of beta, the ‘−−incognito’ command line switch has been available.
So, to get this switch working with a short cut, do the following:
Copy the existing Chrome shortcut in your quicklaunch bar, desktop, or start menu.
Rename the shortcut to something obvious, I called mine “Chrome Incognito”.
Right click on the shortcut, and select ‘properties’.
The Properties window opens, and you can select the ‘Shortcut’ tab as shown below:
Note the ‘Target’ path field
In the ‘Target:’ field, add the switch ‘ −−incognito’ to the end of the target path, as shown below:
incognito ‘Switch’ added to target path
Click ‘OK’ to save your changes.
There, all done, that shortcut will now open Chrome in incognito mode window. If you have other normal chrome windows open, they will not be effected by this window. For example, you can stay logged into a google account, a live account, or any other persistent cookie/session driven system. Incognito windows are also great for logging into online banking sites if you’re a bit paranoid.
Note: If you have a 0.* version you will need to upgrade to v1.* or higher.
Problem: This one crops up every-so-often, and a colleague just asked me again, so it’s probably worth posting. When an FLV is loaded into a Flash app, the FLV file is ‘played’ when the SWF or Projector is run. When this is done locally – i.e. you run an SWF from your hard drive, or file server – it’ll work fine. The problem comes when you upload it to your IIS web server. The server probably won’t recognise the ‘.flv’ filetype, so it’ll display nothing.
Solution: To make your IIS 6 web server aware of FLV files, do the following:
Open ‘IIS Manager’.
Right click on your site in ‘Web Sites’, and select ‘Properties’.
Choose the ‘HTTP Headers’ tab.
Click the ‘MIME Types…’ button on the bottom-right.
Click ‘New…’ and then add ‘.flv’ and ‘video/x-flv’ as shown below:
‘Ok’ your way out, and ‘Apply’ when needed.
Your video should now play in a browser when embed in an SWF.
Note: You might have to stop and start ISS, but I didn’t when I added the Mime type a few hours ago.
Questions? Please leave a comment…
Please let me know if this post was useful with a click! (No Ratings Yet) Loading...