Skip to content

Instantly share code, notes, and snippets.

View transfer-xonsh-history.py
#!/usr/bin/env python
import argparse
import enum
import sqlite3
import pathlib
import json
import typing as T
XONSH_DATA_DIRECTORY = pathlib.Path("~/.local/share/xonsh").expanduser()
View test.py
import shutil
from pathlib import Path
temp_file_path = Path(tempfile.mkdtemp()) / "test.txt"
temp_file_path.touch()
temp_dest_path = Path(tempfile.mkdtemp())
shutil.move(temp_file_path, temp_dest_path)
View ddg.py
__version__ = '0.1.0'
import argparse
import collections
import concurrent.futures
import enum
import os
import posixpath
import re
import urllib.parse
View comixology-to-ubooquity.py
#!/usr/bin/env python
import argparse
import collections
import functools
import json
import os
import random
import re
import time
View test.py
def take_window_screenshot(window_id, decoration_level=None):
primary_screen = QApplication.primaryScreen()
pixmap = primary_screen.grabWindow(window_id)
decoration_level = decoration_level if decoration_level is not None else get_window_manager_decoration_level()
# No decoration known, so simply return the regular pixmap
if not decoration_level:
return pixmap
decorated_geometry = xpybutil.window.__get_geometry(_get_nth_parent_window(window_id, decoration_level))
decorated_pixmap = primary_screen.grabWindow(_DESKTOP_WINDOW_ID, *decorated_geometry)
View oof.py
import collections
import functools
from typing import Any, Dict, Iterable, Mapping, Optional
import box
import yaml
from fanfare.paths import defaults_config_path, user_config_path
View mirrorlist
################################################################################
################# Arch Linux mirrorlist generated by Reflector #################
################################################################################
# With: reflector --age 6 --country Germany --latest 30 --number 20 --sort rate --save /etc/pacman.d/mirrorlist -p https -p https -p https
# When: 2019-07-13 11:02:13 UTC
# From: https://www.archlinux.org/mirrors/status/json/
# Retrieved: 2019-07-13 11:02:07 UTC
# Last Check: 2019-07-13 10:46:43 UTC
View gist:8b3253f0c32094133f1ce1ceb37f2595
[ 3482.081778] VFS: busy inodes on changed media or resized disk sdf
[ 3482.159247] print_req_error: I/O error, dev sdf, sector 1
[ 3482.159264] FAT-fs (sdf): bread failed in fat_clusters_flush
[ 3482.159364] print_req_error: I/O error, dev sdf, sector 0
[ 3482.159391] FAT-fs (sdf): unable to read boot sector to mark fs as dirty
View main_view.enaml
import os
from enaml.image import Image
from enaml.widgets.api import Action, Container, ImageView, Label, MainWindow, Menu, MenuBar, StatusBar, StatusItem, FileDialogEx
enamldef MainWindow(MainWindow): window:
title << 'Image Viewer - %s' % os.path.basename(folder.path) if folder.path else 'Image Viewer'
attr folder
View folder_model.py
import os
import magic
from atom.api import Atom, Bytes, Int, List, Str, observe
from enaml.image import Image
# https://pypi.org/project/natsort/
from natsort import natsorted
class ImageFolder(Atom):
You can’t perform that action at this time.