sudo hostnamectl set-hostname example.com
sudo apt install mailutils postfix
-
- Choose "internet site", and type your domain (example.com)
mail [email protected] -s "Subject"
- You should receive a mail from
[email protected]
sudo hostnamectl set-hostname example.com
sudo apt install mailutils postfix
mail [email protected] -s "Subject"
[email protected]
This nginx configuration allows to restrict access via different methods to separate users.
This is very useful for private docker registries, where you want every member of your team to be able to fetch Docker images, but only some users (admins and CI users) to push new images to the registry.
Example:
write
can use GET, POST, PUT, DELETE and everything else.read
can only use GET and HEAD.HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
#!/bin/bash | |
#Precommit hook to prevent "debugger" and "console.log" | |
#Note: to enamble precommit on Windows machine don't forget add path to Git\bin and Git\cmd to PATH environment variable | |
count=0 | |
for FILE in `git diff-index --name-status HEAD -- | cut -c3-` ; do | |
# Check if the file contains 'debugger' or 'console.log' | |
contains=`grep -e "debugger" -e "console\.log" -e "binding\.pry" $FILE` | |
if [ `grep -e "debugger" -e "console\.log" -e "binding\.pry" $FILE|wc -l` -ne 0 ] |
#!/usr/bin/env ruby | |
require 'english' | |
require 'rubocop' | |
ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
changed_files = `git status --porcelain`.split(/\n/). | |
select { |file_name_with_status| | |
file_name_with_status =~ ADDED_OR_MODIFIED |
#Mobile Device Detection via User Agent RegEx
Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.
I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.
The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".
Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(