This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Tue Oct 27 13:59:03 2020 | |
| @author: xyz | |
| This code is used to resize the images from dir/subdir to new directory (newdir/subdir) with its corresponding subdirectory | |
| Original folder with it subdir: | |
| ..\DATA\ORI-DIR |
This file contains hidden or 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
| """ | |
| ODBC Python | |
| https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Linux | |
| ODBC Driver for MS SQL Server | |
| https://docs.microsoft.com/es-es/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server | |
| From linux we can access to MS SQL server using kerberos | |
| https://inbo.github.io/tutorials/installation/user/user_install_kerberos/ | |
| Kerberos-python | |
| https://pypi.org/project/kerberos/ |
This file contains hidden or 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 | |
| import os | |
| import sys | |
| import argparse | |
| from PIL import Image | |
| """ | |
| Reduce images size | |
| Images are resized keeping the aspect ratio | |
| Usage: python image_resize.py -d /home/images -o /home/output_dir -s 1024 768 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 requests | |
| from bs4 import BeautifulSoup | |
| # We've now imported the two packages that will do the heavy lifting | |
| # for us, reqeusts and BeautifulSoup | |
| # Let's put the URL of the page we want to scrape in a variable | |
| # so that our code down below can be a little cleaner | |
| url_to_scrape = 'http://apps2.polkcountyiowa.gov/inmatesontheweb/' |
This file contains hidden or 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 unittest module for creating unit tests | |
| import unittest | |
| # Import time module to implement | |
| import time | |
| # Import the Selenium 2 module (aka "webdriver") | |
| from selenium import webdriver | |
| # For automating data input |
This file contains hidden or 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 http://soledadpenades.com/2009/10/29/fastest-way-to-generate-wav-files-in-python-using-the-wave-module/ | |
| import wave | |
| import random | |
| import struct | |
| import datetime | |
| SAMPLE_LEN = 44100 * 300 # 300 seconds of noise, 5 minutes | |
| print "Create file using wave and writeframes twice in each iteration" |
This file contains hidden or 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 | |
| # | |
| # Converts any integer into a base [BASE] number. I have chosen 62 | |
| # as it is meant to represent the integers using all the alphanumeric | |
| # characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
| # | |
| # I plan on using this to shorten the representation of possibly long ids, | |
| # a la url shortenters | |
| # |
This file contains hidden or 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 | |
| import Image | |
| import os, sys | |
| def resizeImage(infile, dir, output_dir="", size=(1024,768)): | |
| outfile = os.path.splitext(infile)[0]+"_resized" | |
| extension = os.path.splitext(infile)[1] | |
| if extension.lower()!= ".jpg": |