May 12, 2016 - Chore App

Chore App

I made this chore asigning application for a small college dorm. Its purpose is to randomly assign chores to residents with respect to gender. A male (m) will get a male chore or gender neutral chore (n) and female (f) will get a female chore or gender neutral chore. Note random is not fair. Good Luck

The files needed

  • list of residents
   gender firstname lastname
   m john smith
   f julie smith
   m tom appleseed
  • list of chores
  gender chore
  f clean womens bathroom
  n mop hallway
  m clean mens showers
  • ChoreApp.py

  • clean.icns - an icon file

Build the App

Setup Python Virtaul Environment

pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install xlwt py2app

Chore App Code

Please place chore app code in a seperate directory differnet to the python virtual environment.

import os, sys,random, xlwt, time, datetime
from xlwt import *

#file imports
chore_file=open("../../../chores.txt", "r")
chores = chore_file.readlines()
#print chores

resident_file=open("../../../residents.txt", "r")
residents = resident_file.readlines()
#print residents

#create a psueode final enum
# m equals male
# f equals female
# n equals neutral

#creates excel file
book = xlwt.Workbook(encoding="utf-8")
sheet1 = book.add_sheet("Sheet 1")

font0 = Font()
font0.bold = True

style0 = XFStyle()
style0.font = font0


#error check
if len(chores) != len(residents):
    print "Error:"
    if len(chores) > len(residents):
            sys.exit(" Too many chores")
    else:
            sys.exit(" Too many residents")

assignment = []
i = 0
while(residents):
    rand = random.randrange(0, len(residents))

    # retrieves the f or m before residents name
    resident = residents[rand]
    resident_gender = resident[0:1]
    chore_gender = chores[i][0:1]

    if(resident_gender == chore_gender) or (chore_gender == 'n'):
        len_chore = len(chores[i])
        len_resident = len(resident)
        print resident[2:len_resident] + " "  + chores[i][2:len_chore]
        tupl = [resident[2:len_resident].replace('\n',''), chores[i][2:len_chore].replace('\n','')]
        assignment.append(tupl)
        residents.pop(rand)
        i=i+1

#alphabetically sort
assignment.sort()
#write out alphabetically sorted chore list
j=1
date = datetime.datetime.now()
enddate = datetime.datetime.now() + datetime.timedelta(days=6)
sheet1.write(0,0,"Chore List For Week Of " + date.strftime('%m/%d') +" - "+ enddate.strftime('%m/%d'), style0)
for i in assignment:
    sheet1.write(j,0,i[0])
    sheet1.write(j,1,i[1])
    sheet1.write(j+1,0,'')
    j=j+2

#saves excell file
book.save("../../../chores"+ date.strftime('%Y_%m_%d') + ".xls")
#book.save("chores"+ date.strftime('%Y_%m_%d') + ".xls")


The Build

Change the the working direcotry to the chore_app and create a file called setup.py

cd chore_app
vim setup.py
   """
   This is a setup.py script generated by py2applet

   Usage:
   python setup.py py2app
   """
   from setuptools import setup

   APP = ['ChoreApp.py']
   DATA_FILES = ['chores.txt','residents.txt']
   OPTIONS = {
    'argv_emulation': True,
    'iconfile': 'clean.icns',
    'plist': {
        'CFBundleName': "ChoreApp",
        'CFBundleDisplayName': "ChoreApp",
        'CFBundleGetInfoString': "App for assigning chore",
        'CFBundleVersion': "0.2.0",
        'CFBundleShortVersionString': "0.2.0",
        'NSHumanReadableCopyright': u"Copyleft Devon Peel"
    }
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

Time to build the App

python setup.py py2app

Run ChoreApp

Place the ChoreApp file created in the above command with the chores.txt file and residents.txt file in the same directory. Then click on the ChoreApp to generate the output file assigning chores to residents.

May 11, 2016 - Chocolatey "The Windows" Package Manager

Install Chocolatey via PowerShell

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) 

Install via Command Prompt

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Create a repo

 choco new <project name>

Edit the .nuspect file, install, and uninstall files under the tools directory

May 10, 2016 - Irssi Setup

In the irssi config add the following:

Setting up crapbuser.pl

In the aliases section add

cb = "/crapbuster";

In the setting section add

  "perl/core/scripts" = {
              crapbuster_levels = "JOINS PARTS QUITS  CLIENTCRAP CRAP MODE  KICKSi";
   };

Setting Up logging

In the setting section add the following

settings = {
  core = {    log_timestamp = "%H:%M:%S ";
    recode_autodetect_utf8 = "yes";
    recode_fallback = "ISO-8859-15";
    recode_out_default_charset = "ISO-8859-15";
    recode_transliterate = "yes";
    recode = "yes";
  };
  "fe-text" = { actlist_sort = "refnum"; };
  "fe-common/core" = {
    autolog = "yes";
    autolog_path = "~/.irssi/logs/%Y/$0/%m-%d.log";
    term_charset = "utf-8";
    activity_hide_level = "= JOINS QUITS";
  };
 
};

Downloading the Scripts

In .irssi/scripts add the following perlscripts from https://scripts.irssi.org/

  • awayproxy.pl

  • crapbuster.pl

  • screen_away.pl (may want to eidt this script)

Startup

Create a startup script in .irssi/startup

/set term_charset utf-8
/set recode_autodetect_utf8 ON
/set recode_fallback ISO-8859-15
/set recode_out_default_charset ISO-8859-15
/set recode_transliterate ON
/set recode ON
/load crapbuster.pl
/set crapbuster_levels JOINS PARTS QUITS  CLIENTCRAP CRAP MODE  KICKSi
/alias cb /crapbuster
/load awayproxy.pl
/load screen_away.pl