nmcli general permissions
PERMISSION VALUE
org.freedesktop.NetworkManager.checkpoint-rollback auth
org.freedesktop.NetworkManager.enable-disable-connectivity-check да
org.freedesktop.NetworkManager.enable-disable-network да
org.freedesktop.NetworkManager.enable-disable-statistics да
org.freedesktop.NetworkManager.enable-disable-wifi да
org.freedesktop.NetworkManager.enable-disable-wimax да
org.freedesktop.NetworkManager.enable-disable-wwan да
org.freedesktop.NetworkManager.network-control да
org.freedesktop.NetworkManager.reload auth
org.freedesktop.NetworkManager.settings.modify.global-dns auth
org.freedesktop.NetworkManager.settings.modify.hostname auth
org.freedesktop.NetworkManager.settings.modify.own да
org.freedesktop.NetworkManager.settings.modify.system да
org.freedesktop.NetworkManager.sleep-wake нет
org.freedesktop.NetworkManager.wifi.scan да
org.freedesktop.NetworkManager.wifi.share.open да
org.freedesktop.NetworkManager.wifi.share.protected да
/* /etc/polkit-1/rules.d/99-vashe_pravilo.rules */
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.settings.modify.system" && subject.user == "user") {
return polkit.Result.NO;
}
});
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.settings.modify.own" && subject.user == "user") {
return polkit.Result.NO;
}
});
/* /etc/polkit-1/rules.d/99-vashe_pravilo.rules */
polkit.addRule(function(action, subject) {
if (action.id.match(/^org\.freedesktop\.NetworkManager\..*/) && subject.user == "user") {
return polkit.Result.AUTH_ADMIN;
}
});
from PIL import Image
# create a list of image filenames
filenames = ["image1.png", "image2.png", "image3.png"]
# open the first image and save it as tiff
im = Image.open(filenames[0])
im.save("output.tiff")
# loop through the rest of the images and append them to the tiff file
for filename in filenames[1:]:
im = Image.open(filename)
im.save("output.tiff", append_images=[im])
png1 = io.BytesIO()
plt.savefig(png1)
>>> type(input)
<class 'builtin_function_or_method'>
>>> input.__dir__()
['__repr__', '__hash__', '__call__', '__getattribute__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__reduce__', '__module__', '__doc__', '__name__', '__qualname__', '__self__', '__text_signature__', '__new__', '__str__', '__setattr__', '__delattr__', '__init__', '__reduce_ex__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__']
>>> input.__doc__
'Read a string from standard input. The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available.'
>>>
def can_rearrange(old_num, new_num):
numbs = {"0":"01111110", "1":"00110000", "2":"01101101", "3":"01111001", "4":"00110011",
"5":"01011011", "6":"01011111", "7":"01110000", "8":"01111111", "9":"01111011",
" ":"00000000"
}
a = "".join([numbs[x] for x in old_num])
b = "".join([numbs[x] for x in new_num])
c = "".join([str(int(a[x]) ^ int(b[x])) for x in range(len(a))])
return c.count("1") == 4
print(can_rearrange("1576", " 876")) #true
print(can_rearrange("1576", " 875")) #false
print(can_rearrange("1576", "1518")) #false
print(can_rearrange("1576", "1815")) #true