In
another mailbox:
Security and Filtering -> Acceptance and Routing -> Advanced settings -> Add acceptance / routing rule
Phew! Now in
Now in
This is it.
#mail #mail_server #axigen #filter #routing
axigen
mail server you can set a filter that if sender email address (from) has a specific text using regexp then redirect it toanother mailbox:
Security and Filtering -> Acceptance and Routing -> Advanced settings -> Add acceptance / routing rule
Phew! Now in
Conditions
section open combo box and select Email
under Recipient
. Click Add condition
. A text box is appeared now which you can select Regexp
from the combo box and enter your regex like:.*SpecificSender.*
Now in
actions
section in name enter the mail address you want to receive emails in and in Folder text box enter INBOX
.This is it.
#mail #mail_server #axigen #filter #routing
What is filters in
Filter is a way to tell logger not to log or to log something. Let's say you print sensitive data in a core module that can also handle passwords. Here you don't want to record user passwords in you logs! Do you?!
The above method will not log lines which start with
to not record them or mask the password part by chaning the the log using:
Just get your message using the above line and replace it with something you want.
#python #logging #filter
Python Logging
and what we can do with it?Filter is a way to tell logger not to log or to log something. Let's say you print sensitive data in a core module that can also handle passwords. Here you don't want to record user passwords in you logs! Do you?!
class NoPasswordFilter(logging.Filter):
def filter(self, record):
return not record.getMessage().startswith('password')
logger.addFilter(NoPasswordFilter())
The above method will not log lines which start with
password
. You can use regex to find your template in you logs and return falseto not record them or mask the password part by chaning the the log using:
record.msg
Just get your message using the above line and replace it with something you want.
#python #logging #filter
Tech C**P
What is filters in Python Logging and what we can do with it? Filter is a way to tell logger not to log or to log something. Let's say you print sensitive data in a core module that can also handle passwords. Here you don't want to record user passwords…
If you are using
logging
module:logging.getLogger(__name__).addFilter(NoPasswordFilter())
# How to merge two dictionaries
# in Python 3.5+
>>> x = {'a': 1, 'b': 2}
>>> y = {'b': 3, 'c': 4}
>>> z = {**x, **y}
>>> z
{'c': 4, 'a': 1, 'b': 3}
# In Python 2.x you could
# use this:
>>> z = dict(x, **y)
>>> z
{'a': 1, 'c': 4, 'b': 3}
# In these examples, Python merges dictionary keys
# in the order listed in the expression, overwriting
# duplicates from left to right.
# in Python 3.5+
>>> x = {'a': 1, 'b': 2}
>>> y = {'b': 3, 'c': 4}
>>> z = {**x, **y}
>>> z
{'c': 4, 'a': 1, 'b': 3}
# In Python 2.x you could
# use this:
>>> z = dict(x, **y)
>>> z
{'a': 1, 'c': 4, 'b': 3}
# In these examples, Python merges dictionary keys
# in the order listed in the expression, overwriting
# duplicates from left to right.
Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct. However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we mask it.
Your task is to write a function maskify, which changes all but the last four characters into '#'.
Examples:
#python #maskify
Your task is to write a function maskify, which changes all but the last four characters into '#'.
Examples:
maskify("4556364607935616") == "############5616"
maskify( "64607935616") == "#######5616"
maskify( "1") == "1"
maskify( "") == ""
# "What was the name of your first pet?"
maskify("Skippy") == "##ippy"
maskify("Nananananananananananananananana Batman!") == "####################################man!"
#python #maskify
Tech C**P
Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct. However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we…
# How to sort a Python dict by value
# (== get a representation sorted by value)
>>> xs = {'a': 4, 'b': 3, 'c': 2, 'd': 1}
>>> sorted(xs.items(), key=lambda x: x[1])
[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
# Or:
>>> import operator
>>> sorted(xs.items(), key=operator.itemgetter(1))
[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
#python
# (== get a representation sorted by value)
>>> xs = {'a': 4, 'b': 3, 'c': 2, 'd': 1}
>>> sorted(xs.items(), key=lambda x: x[1])
[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
# Or:
>>> import operator
>>> sorted(xs.items(), key=operator.itemgetter(1))
[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
#python
Python dictionary:
#pytricks
# The get() method on dicts
# and its "default" argument
name_for_userid = {
382: "Alice",
590: "Bob",
951: "Dilbert",
}
def greeting(userid):
return "Hi %s!" % name_for_userid.get(userid, "there")
>>> greeting(382)
"Hi Alice!"
>>> greeting(333333)
"Hi there!"
#pytricks
https://workplace.stackexchange.com/questions/125610/is-it-okay-to-refuse-entirely-to-answer-desired-salary-question
#workplace #salary
#workplace #salary
The Workplace Stack Exchange
Is it okay to refuse entirely to answer "desired salary" question?
I am finishing up a graduate degree and am looking for my first full-time job. I recently had a second interview (Skype) with a place I'm interested in and the interviewer asked me what my desired
Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized.
Examples:
#python #codewars
Examples:
to_camel_case("the-stealth-warrior") # returns "theStealthWarrior"
to_camel_case("The_Stealth_Warrior") # returns "TheStealthWarrior"
#python #codewars
Tech C**P
Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized. Examples: to_camel_case("the-stealth-warrior") # returns…
Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS)
#python #codewars #datetime
HH = hours, padded to 2 digits, range: 00 - 99
MM = minutes, padded to 2 digits, range: 00 - 59
SS = seconds, padded to 2 digits, range: 00 - 59
#python #codewars #datetime
Tech C**P
Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS) HH = hours, padded to 2 digits, range: 00 - 99 MM = minutes, padded to 2 digits, range: 00 - 59 SS = seconds, padded to…
If you forget to pull your projects from git in a regular interval and many users working on the same projects, then there is a solution for you!
Create a bash script file as follow and make it executable by
Now as a final step, put it in your crontab:
#linux #git #pull #cronjob #crontab #cron #bash
Create a bash script file as follow and make it executable by
chmod +x puller.sh
:puller.sh
file content:#!/bin/bash
echo 'Iterating over folders...'
for dir in *
do
test -d "$dir" && {
cd ${dir}
echo "git pull $dir"
git pull
cd ".."
} || {
echo "------> $dir is not a directory <-------"
}
done
NOTE:
this file should reside in your folder's project root. In my case it is in /Your/Projects/Folder
.Now as a final step, put it in your crontab:
10 * * * * bash -c "cd /Your/Projects/Folder; bash puller.sh >> /var/log/git_pull_output.log"
#linux #git #pull #cronjob #crontab #cron #bash
Count the number of Duplicates
Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits.
Example:
"abcde" -> 0 # no characters repeats more than once
"aabbcde" -> 2 # 'a' and 'b'
"aabBcde" -> 2 # 'a' occurs twice and 'b' twice (`b` and `B`)
"indivisibility" -> 1 # 'i' occurs six times
"Indivisibilities" -> 2 # 'i' occurs seven times and 's' occurs twice
"aA11" -> 2 # 'a' and '1'
"ABBA" -> 2 # 'A' and 'B' each occur twice
What is your solution?
#python #codewars
Tech C**P
Count the number of Duplicates Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both…