Skip to content

Instantly share code, notes, and snippets.

@resurrexi
resurrexi / clear_dir.py
Created December 29, 2019 02:03
python code to clean up a directory
"""
###################################################################################################
# A DIRECTORY CLEANER FOR AUTOMATING DELETION OF FILES AND/OR SUBDIRECTORIES #
# ----------------------------------------------------------------------------------------------- #
# Liquan Yang #
# liquan.yang@bcbsfl.com #
###################################################################################################
"""
from datetime import datetime
@resurrexi
resurrexi / print_barcode.py
Last active April 19, 2021 10:05
Print barcode with a Brother label printer on an RPi
from io import BytesIO
from PIL import Image
from barcode.writer import ImageWriter
from barcode import generate
from brother_ql import BrotherQLRaster, create_label
from brother_ql.backends.helpers import send
def print_barcode(data, printer, backend=None, model='QL-700', code='code128',
label='29x90'):
@resurrexi
resurrexi / tempzipflaskapp.py
Created January 16, 2019 12:44
serving a temporary zip file from a directory in flask
import os
import zipfile
import tempfile
from flask import Flask, render_template, request, Response
from datetime import datetime
from string import Template
FILEPATH = os.path.dirname(os.path.realpath(__file__))
TEMPLATE_FOLDER = os.path.join(FILEPATH, "templates")
TEMP_FOLDER = os.path.join(FILEPATH, "temp")
@resurrexi
resurrexi / .bashrc
Created October 21, 2017 23:20
bashrc file for colors and git branch info
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@resurrexi
resurrexi / .profile
Created October 9, 2017 16:14
My profile script for Deepin OS on Chromebook Pixel 2
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022