Skip to content

Instantly share code, notes, and snippets.

View Hammer2900's full-sized avatar
🌲
___

Yevhen Ts. Hammer2900

🌲
___
View GitHub Profile
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
# 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 = '.'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Topmenu and the submenus are based of the example found at this location http://blog.skeltonnetworks.com/2010/03/python-curses-custom-menu/
# The rest of the work was done by Matthew Bennett and he requests you keep these two mentions when you reuse the code :-)
# Basic code refactoring by Andrew Scheller
from time import sleep
import curses, os #curses is the interface for capturing key presses on the menu, os launches the files
screen = curses.initscr() #initializes a new window for capturing key presses
curses.noecho() # Disables automatic echoing of key presses (prevents program from input each key twice)
#!/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
@Hammer2900
Hammer2900 / deploy_to_s3.py
Created November 30, 2015 07:36 — forked from robert-b-clarke/deploy_to_s3.py
A simple python script for copying static web resources to an S3 bucket and advance gzipping JS and CSS. Let me know if it's useful (and not already implemented by something else), I may make it into a proper repo
"""
===========
Description
===========
Simple script to copy and gzip static web files to an AWS S3 bucket. S3 is great for cheap hosting of static web content, but by default it does not gzip CSS and JavaScript, which results in much larger data transfer and longer load times for many applications
When using this script CSS and JavaScript files are gzipped in transition, and appropriate headers set as per the technique described here: http://www.jamiebegin.com/serving-compressed-gzipped-static-files-from-amazon-s3-or-cloudfront/
* Files overwrite old versions
@Hammer2900
Hammer2900 / download_multiple.py
Created September 28, 2016 17:51 — forked from harrisont/download_multiple.py
Use asyncio and aiohttp to asynchronously download multiple files at once and handle the responses as they finish
import asyncio
from contextlib import closing
import aiohttp
async def download_file(session: aiohttp.ClientSession, url: str):
async with session.get(url) as response:
assert response.status == 200
# For large files use response.content.read(chunk_size) instead.
@Hammer2900
Hammer2900 / async_scraper.py
Created October 2, 2016 11:08 — forked from wtneal/async_scraper.py
asyncio scraper
import asyncio
import aiofiles
import aiohttp
import logging
import re
import sys
import os
import lxml.html
@Hammer2900
Hammer2900 / organize_directory.py
Created October 2, 2016 15:23 — forked from konstantinfarrell/organize_directory.py
Python script that cleans up my downloads folder
import shutil
import mimetypes
from os import listdir
from os.path import isfile, join
ORIGIN = r"C:\Users\Konstantin\Downloads\\" # Change these. Unless your system
# happens to have the same configuration.
MUSIC_DESTINATION = r"C:\Users\Konstantin\Music\\"
PICTURE_DESTINATION = r"C:\Users\Konstantin\Pictures\\"
PDF_DESTINATION = r"C:\Users\Konstantin\Documents\\"
@Hammer2900
Hammer2900 / example.py
Created October 4, 2016 18:22 — forked from diosmosis/example.py
Python decorator that catches exceptions and logs a traceback that includes every local variable of each frame.
import os
from log_exceptions import log_exceptions
def throw_something(a1, a2):
raise Exception('Whoops!')
@log_exceptions(log_if = os.getenv('MYAPP_DEBUG') is not None)
def my_function(arg1, arg2):
throw_something(arg1 + 24, arg2 - 24)
@Hammer2900
Hammer2900 / Ranger
Created October 13, 2016 20:53 — forked from abyshakes/Ranger
ranger
sudo apt-get install ranger caca-utils highlight atool w3m poppler-utils mediainfo trash-cli
ranger --copy-config=scope
map <DELETE> shell trash-put %s