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 django.contrib import admin | |
#other imports removed | |
def copy_course(modeladmin, request, queryset): | |
import copy | |
for course in queryset: | |
# multiple could be selected | |
course_copy = copy.copy(course) # django copy object |
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 | |
from PIL import Image | |
size = 145, 145 | |
dir_path = '/Users/brian/Desktop/systems' | |
for filename in os.listdir(dir_path): | |
if filename.endswith('.bmp'): | |
# Destroy Previously Converted BMP | |
try: | |
os.remove(os.path.join(dir_path,filename.replace('.jpg','.bmp'))) | |
except: |
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 | |
from PIL import Image | |
size = 145, 145 | |
dir_path = '/Users/brian/Desktop/systems_silly' | |
for filename in os.listdir(dir_path): | |
if filename.endswith('.bmp'): | |
# Destroy Previously Converted Bmp | |
try: | |
os.remove(os.path.join(dir_path,filename.replace('.jpg','.bmp'))) | |
except: |
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 sys | |
import datetime | |
from datetime import datetime | |
import csv | |
import traceback | |
from django.core.management.base import BaseCommand, CommandError |
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/python | |
import sys | |
import rrdtool | |
import json | |
MIN_TEMP = 0 | |
ERROR_TEMP = -999.99 | |
TEMP_SENSORS = { | |
"E" : {"sensor":"28-00043a4518ff","location":"Server Room Rack B/C (Back)","temperature":{"celsius":None,"fahrenheit":None}}, |
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 reversion | |
from django.db import models | |
from django.contrib.auth.models import User | |
class RevisionManager(models.Manager): | |
def get_queryset(self): | |
return super(RevisionManager, self).get_queryset().latest() | |
class Ticket_Status(models.Model): |
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/python | |
import tornado.ioloop | |
import tornado.web | |
MIN_TEMP = 0 | |
ERROR_TEMP = -999.99 | |
TEMP_SENSORS = { | |
"28-00043a4518ff" : {"label":"A","location":"Server-1-Front","temperature":None}, | |
"28-00043b61b4ff" : {"label":"B","location":"Server-1-Back","temperature":None}, |
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 changePassword(user_dn, old_password, new_password): | |
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) | |
l = ldap.initialize("LDAPS://DOMAIN.COM") | |
l.set_option(ldap.OPT_REFERRALS,0) | |
l.set_option(ldap.OPT_PROTOCOL_VERSION,3) | |
l.set_option(ldap.OPT_X_TLS,ldap.OPT_X_TLS_DEMAND) | |
l.set_option(ldap.OPT_X_TLS_DEMAND,True) | |
l.set_option(ldap.OPT_DEBUG_LEVEL,255) | |
l.simple_bind_s("[email protected]", "PASSWORD") |
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 base64 import b64encode | |
from reportlab.lib import units | |
from reportlab.graphics import renderPM | |
from reportlab.graphics.barcode import createBarcodeDrawing | |
from reportlab.graphics.shapes import Drawing | |
class barcode: | |
def get_barcode(self, value, width, barWidth = 0.05 * units.inch, fontSize = 30, humanReadable = True): | |
barcode = createBarcodeDrawing('Code128', value = value, barWidth = barWidth, fontSize = fontSize, humanReadable = humanReadable) |
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 | |
image_folder = '/Users/brian/Desktop/Student_Images' | |
image_linkfile = image_folder+'/idlink.txt' | |
f = open(image_linkfile,'wb') | |
for filename in os.listdir(image_folder): | |
filepath = os.path.join(image_folder,filename) | |
if os.path.isfile(filepath): |