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
npub1857yljp0gyd22gwpfqhhu9a86mn8p6eue79re0pe7cvvdwzvrwzshktw9u |
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 | |
""" | |
A very simple and hacky Python3 script to convert 16-bit uncompressed WAV | |
files to MPC-3000 .SND files. | |
The output is modelled to copy the output of Wav2Snd | |
(http://www.mpc3000.com/wavsnd.htm) but this might be a bit more portable | |
to run on modern machines. |
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 | |
# Assumes the BeautifulSoup4 and Requests libraries are installed. | |
# pip install bs4 requests | |
import requests | |
from bs4 import BeautifulSoup | |
from requests.compat import urljoin |
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
width = models.PositiveIntegerField(_("height"), db_index=True) | |
height = models.PositiveIntegerField(_("width"), db_index=True) | |
def is_horizontal(self): | |
if float(self.height) / self.width <= 0.7: | |
return True | |
def is_vertical(self): | |
if float(self.height) / self.width > 0.7: | |
return True |
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 os | |
import envdir | |
from pathlib import Path | |
from celery import Celery | |
from django.conf import settings | |
from configurations import importer |
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
from datetime import timedelta | |
from time import sleep | |
from celery.task import task | |
from django.core.management.base import BaseCommand, CommandError | |
from django.utils import timezone | |
@task | |
def add(x, y): |
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 | |
# Auto-check for pep8 so I don't check in bad code | |
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -e '\.py$') | |
if [ -n "$FILES" ]; then | |
flake8 --max-line-length=100 $FILES | |
fi |
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
""" Python Command and Character list | |
(from Learn Python the Hardway by Zed Shaw) | |
expanded from Lesson 22 | |
""" | |
#Character / Command What it's called What it does example example2 | |
pydoc <something> #pydoc gives you the manual page for something you want to know about in python pydoc sys | |
help() #help function use when running python to find help on an object | |
print() #print function prints to the console whatever is next print(“Hello World!”) print(1 + 2) |
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
from BeautifulSoup import BeautifulSoup | |
from urlparse import urlparse | |
import re | |
import urllib2 | |
if __name__ == "__main__": | |
""" driver code """ | |
# extract html | |
url = 'http://www.utexas.edu/world/univ/alpha/' | |
usock = urllib2.urlopen(url) |
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
def install_irssi(): | |
sudo("apt-get install -y screen irssi bitlbee libcrypt-dh-perl libcrypt-openssl-bignum-perl libcrypt-blowfish-perl") | |
# libtime-duration-perl libnotify-bin irssi-plugin-otr bitlbee-plugin-otr") | |
server_ip = env.host_string.split(":")[0] | |
local("rsync --links -e 'ssh -p {0}' -avzp ~/.irssi/ {1}@{2}:{3}.irssi/ \ | |
--exclude='*.log'".format(settings.SSH_PORT, settings.DEPLOY_USERNAME, server_ip, settings.DEPLOY_HOME)) | |
sed("{0}.irssi/config".format(settings.DEPLOY_HOME), "BITLBEE_PASSWORD", os.environ["BITLBEE_PASSWORD"]) | |
with fab_settings(warn_only=True): | |
put("~/.screenrc", os.path.join(settings.DEPLOY_HOME, ".screenrc")) | |
put("~/dotfiles/bitlbee.conf", "/etc/bitlbee/bitlbee.conf", use_sudo=True) |
NewerOlder