Skip to content

Instantly share code, notes, and snippets.

View jillvp's full-sized avatar

Jill van Put jillvp

  • Rotterdam, The Netherlands
View GitHub Profile
@justudin
justudin / resizeImg.py
Last active November 16, 2021 16:06
bulk resize image with python with its its corresponding subdirectory/folder
# -*- 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
@asdf8601
asdf8601 / 165-prueba.py
Last active November 11, 2020 21:00
[Connect database] How to connect to MS SQL Server from linux and windnows using pyodbc or sqlalchemy. #python #db #database #linux #windows #odbc
"""
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/
@Saigesp
Saigesp / image_resize.py
Last active December 4, 2020 15:53
Python script to resize images, with command line arguments. Adapted from https://gist.github.com/ihercowitz/642650/f01986c0b1ebd04be588b196eb3ffefe9853e113
#!/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.
@phillipsm
phillipsm / gist:0ed98b2585f0ada5a769
Last active February 7, 2025 19:55
Example of parsing a table using BeautifulSoup and requests in Python
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/'
@devinmancuso
devinmancuso / chromemobiletest.py
Last active May 26, 2023 11:00
Example Python Chrome Mobile Emulation Automated Unit Testing Using Selenium 2 WebDriver ChromeDriver
# 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
@lambdamusic
lambdamusic / generate_noise.py
Created March 10, 2013 17:01
Python: generate audio noise
# 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"
#!/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
#
@ihercowitz
ihercowitz / image_resize.py
Created October 23, 2010 20:19
Python Script to resize all the images, on a given directory, to a 1024x768 JPEG format.
#!/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":