Skip to content

Instantly share code, notes, and snippets.

View AnBucquet's full-sized avatar

BUCQUET Anthime AnBucquet

View GitHub Profile
# Solution one
a='AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
t=input().replace(' ','')
x = [c for c in t if not c.isalpha()]
b = [c for c in t if c.isalpha()]
s = sorted(b,key=lambda c:a.index(c))
@AnBucquet
AnBucquet / check_parentheses_brackets.py
Last active April 10, 2020 12:05
Checking parentheses and brackets
# This gist aims to check the parentheses and brackets in a mathematical expression like "((2+3)*[5**2+1])*(40+2)".
import sys
import math
t = input()
s = []
for c in t:
if c in ("(", "[", "{"):
@AnBucquet
AnBucquet / crop_images
Created January 17, 2019 10:26
A little function to split an image into many and save them into a specific directory.
from PIL import Image
def split(path, input, height, width):
im = Image.open(input)
k = 0
imgwidth, imgheight = im.size
for i in range(0,imgheight,height):
for j in range(0,imgwidth,width):
box = (j, i, j+width, i+height)
a = im.crop(box)
@AnBucquet
AnBucquet / convert-save.py
Last active January 15, 2019 12:32 — forked from jbdrvl/convert-save.py
For a project - takes pics in a folder, resizes them and saves them into another folder
#!/usr/bin/env python3
#!/usr/bin/env python
"""
A script designed to
1) resize all of the downloaded images to desired dimension (DEFAULT 64x64 pixels) and
2) rename images in folders from 1.png to n.png for ease of use in training
Modified version from https://github.com/rkjones4/GANGogh/blob/master/misc/picStuff.py
"""