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
#!/bin/sh | |
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; | |
do | |
echo $output | |
used=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) | |
partition=$(echo $output | awk '{ print $2 }' ) | |
if [ $used -ge 80 ]; then | |
echo "The partition \"$partition\" on $(hostname) has used $used% at $(date)" | mail -s "Disk space alert: $used% used" your@email.com | |
fi | |
done |
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 | |
'''Crop an image to just the portions containing text. | |
Usage: | |
./crop_morphology.py path/to/image.jpg | |
This will place the cropped image in path/to/image.crop.png. | |
For details on the methodology, see |
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 cv2 | |
import numpy as np | |
# read and scale down image | |
# wget https://bigsnarf.files.wordpress.com/2017/05/hammer.png #black and white | |
# wget https://i1.wp.com/images.hgmsites.net/hug/2011-volvo-s60_100323431_h.jpg | |
img = cv2.pyrDown(cv2.imread('2011-volvo-s60_100323431_h.jpg', cv2.IMREAD_UNCHANGED)) | |
# threshold image | |
ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), |
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
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN: "[!!{username}!!](usernameOnClick) just joined the server - glhf!", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_01: "[!!{username}!!](usernameOnClick) just joined. Everyone, look busy!", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_02: "[!!{username}!!](usernameOnClick) just joined. Can I get a heal?", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_03: "[!!{username}!!](usernameOnClick) joined your party.", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_04: "[!!{username}!!](usernameOnClick) joined. You must construct additional pylons.", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_05: "Ermagherd. [!!{username}!!](usernameOnClick) is here.", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_06: "Welcome, [!!{username}!!](usernameOnClick). Stay awhile and listen.", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_07: "Welcome, [!!{username}!!](usernameOnClick). We were expecting you ( ͡° ͜ʖ ͡°)", | |
SYSTEM_MESSAGE_GUILD_MEMBER_JOIN_08: "Welcome, [!!{username}!!](usernameOnClick). We hope you brought pi |
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 re | |
def replace(string, substitutions): | |
substrings = sorted(substitutions, key=len, reverse=True) | |
regex = re.compile('|'.join(map(re.escape, substrings))) | |
return regex.sub(lambda match: substitutions[match.group(0)], string) |
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 uuid | |
import random | |
from afase.models.meta import Base | |
from sqlalchemy import ( | |
Column, | |
Text, | |
Date, | |
ForeignKey, |
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 python3 | |
"""Fixing bluetooth stereo headphone/headset problem in debian distros. | |
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197 | |
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone. | |
This will be only fixes the bluez5 problem mentioned above . | |
Licence: Freeware |
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
{% load startswith %} | |
<li{% if request.path|startswith:'/settings/' %} class="active"{% endif %}> |
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 | |
# requires python 3.6 and requests | |
import os | |
import re | |
import secrets | |
import requests | |
wordlist_file = 'diceware.wordlist.asc' |
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
@simple_route("/review/{delivery_uuid}", route_name="review_public", renderer='views/review.html', append_slash=False) | |
def review(request, delivery_uuid): | |
"""Let user to leave a product for delivery. | |
One delivery can contain several product. Each product has Review SQL object instance generated at the time of creation. This form will let review | |
""" | |
delivery_uuid = slug_to_uuid(delivery_uuid) | |
delivery = DBSession.query(models.Delivery).filter_by(uuid=delivery_uuid).first() |
NewerOlder