This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing Arch: | |
sudo vim /etc/pacman.conf | |
Update packages list: sudo pacman -Syy | |
run sudo pacman -Syu before installing any software (to update the repositories first) | |
* Timing issue: | |
- Change hardware clock to use UTC time: | |
sudo timedatectl set-local-rtc 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail | |
# Make sure you have IMAP enabled in your gmail settings. | |
# Right now it won't download same file name twice even if their contents are different. | |
import email | |
import getpass, imaplib | |
import os | |
import sys | |
detach_dir = '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# python_rdesktop_gui.py | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are | |
# met: | |
# | |
# * Redistributions of source code must retain the above copyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [1,2,3,4,5,6,7,8] | |
print zip(*[iter(a)]*3) | |
#[(1, 2, 3), (4, 5, 6)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import pafy | |
import re | |
url = "https://www.youtube.com/watch?v=h1klFHmcw64" | |
video = pafy.new(url) | |
print video.title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PickleFileManager(object): | |
def __init__(self, homedir): | |
self.HOMED = homedir | |
self.dir_is_exsist() | |
def dir_is_exsist(self): | |
if os.path.exists(self.HOMED): | |
pass | |
else: | |
os.mkdir(self.HOMED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import datetime | |
now_date = datetime.date.today() # Текущая дата (без времени) | |
now_time = datetime.datetime.now() # Текущая дата со временем | |
cur_year = now_date.year # Год текущий | |
cur_month = now_date.month # Месяц текущий | |
cur_day = now_date.day # День текущий | |
cur_hour = now_time.hour # Час текущий |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lst = [1,2,3] | |
first_or_default = next((x for x in lst if x == 10), None) | |
print first_or_default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def as_behave_table(data): | |
""" nosetests --with-doctest --with-coverage report_table.py | |
>>> from report_table import as_behave_table | |
>>> data = [('what', 'how', 'who'), | |
... ('lorem', 'that is a long value', 3.1415), | |
... ('ipsum', 89798, 0.2)] |
OlderNewer