Skip to content

Instantly share code, notes, and snippets.

View Hammer2900's full-sized avatar
🚚
Working from home

Yevhen Ts. Hammer2900

🚚
Working from home
View GitHub Profile
@baali
baali / dlAttachments.py
Created May 8, 2012 08:32
Python script to download all gmail attachments.
# 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 = '.'
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
@robert-b-clarke
robert-b-clarke / deploy_to_s3.py
Created January 27, 2014 10:51
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
@fpt
fpt / pykka_periodic.py
Created November 28, 2014 04:43
Pykka: periodic timer
#!/usr/bin/env python
# coding:utf-8
import pykka
import threading
import signal
import time
import sys
@Integralist
Integralist / Python Asyncio Timing Decorator.py
Last active June 30, 2024 09:27
Python Asyncio Timing Decorator
import asyncio
import time
def timeit(func):
async def process(func, *args, **params):
if asyncio.iscoroutinefunction(func):
print('this function is a coroutine: {}'.format(func.__name__))
return await func(*args, **params)
else:
@Kyuuhachi
Kyuuhachi / i3bg2.py
Created December 11, 2016 00:28
i3 per-workspace background for /u/Ghostotw
#!/usr/bin/env python3
import Xlib.threaded
import Xlib
import Xlib.display
from Xlib import Xatom
from PIL import Image
import os.path
from collections import defaultdict
try:
@mattbennett
mattbennett / client.py
Created April 14, 2017 15:00
Nameko Auth Toy
from nameko.standalone.rpc import ClusterRpcProxy
config = {
'AMQP_URI': 'amqp://guest:guest@localhost:5672/'
}
with ClusterRpcProxy(config) as rpc:
session_token = rpc.auth.login("admin", "secret")
with ClusterRpcProxy(config, context_data={'session': session_token}) as rpc:
@tysonholub
tysonholub / windows.py
Last active January 4, 2022 19:04
Elementary OS: Switch windows of the same application
from subprocess import Popen, PIPE, call
import logging
import logging.handlers
import sys
import os
# NOTE: this script assumes a debian system and requires the wmctrl and xdotool packages
# sudo apt-get install wmctrl xdotool
# NOTE: To get [Alt + ` ]to register on Elementary OS requires removing the keybinding via dconf editor for switch-group/switch-group-backward
@tolunayozturk
tolunayozturk / VSCodeNautilusExt.py
Last active January 19, 2022 20:06
"Open in VSCode" extension for Nautilus
# -*- coding: latin-1 -*-
# Copy this python script under ~/.local/share/nautilus-python/extensions and restart nautilus.
# You may need to create nautilus-python and extensions folders if they do not exist. –
import os
import gi
gi.require_version('Nautilus', '3.0')
from gi.repository import Nautilus, GObject
@kapad
kapad / toggle-nightlight.sh
Created July 3, 2018 20:30
Script to toggle the Gnome nightlight setting.
#!/bin/bash
setting=$(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled)
if [[ $setting == "true" ]]; then
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false
else
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
fi