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
# -*- coding: utf-8 -*- | |
from PIL import Image | |
import os | |
import shutil | |
# exists src_dir/hoge.jpg, fuga.png, etc... | |
src_dir = "/Users/name/hoge/" | |
# create dst_dir/yyyymmdd/ | |
dst_dir = "/Users/name/fuga/" |
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
s = input().strip() | |
print(len([x for x in s if x.isupper()]) + (1 if not s[0].isupper() else 0)) |
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
#A small demo of reading from | |
#https://github.com/TUDelftScratchLab/ScratchDataset | |
import csv | |
import sys | |
csv.field_size_limit(sys.maxsize) | |
with open('allBlocks.csv','r') as rawcsv: | |
reader = csv.DictReader(rawcsv,fieldnames =[ | |
'projectID', 'scriptCoordinates', 'scriptIndex', |
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 listInListOrdered(largeList,smallList): | |
if smallList[0] in largeList: | |
i = largeList.index(smallList[0]) | |
for item in smallList: | |
if not item == largeList[i]: | |
return(False) | |
else: | |
i += 1 | |
return(True) | |
else: |
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
# -*- coding: utf-8 -*- | |
#https://raw.githubusercontent.com/LibreOffice/dictionaries/master/el_GR/el_GR.dic | |
#save as utf-8 | |
import codecs | |
rhString = 'ΠΟΙΘΥΛΚΞΗΜΝΒΌΊΎΉΪ' | |
lhString = 'ΕΡΤΑΣΔΦΓΖΧΨΩΈΆΏ' | |
print(rhString.decode('utf-8')) | |
rhMax = 0 | |
rhCount = 0 | |
lhMax = 0 |
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 csv | |
import sys | |
csv.field_size_limit(sys.maxsize) | |
#allBlocks.csv is from https://github.com/TUDelftScratchLab/ScratchDataset | |
with open('allBlocks.csv','r') as rawcsv: | |
reader = csv.DictReader(rawcsv,fieldnames =[ | |
'projectID', 'scriptCoordinates', 'scriptIndex', | |
'stageSpriteindication', 'spriteName', 'indentation', | |
'blockIndex', 'blockType', 'parameters']) |
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
\documentclass{article} | |
\usepackage{amsmath} | |
\begin{document} | |
\begin{align*} | |
999^2&=(999^2 - 1) + 1\\ | |
999^2&=(999^2 - 1^2) + 1\\ | |
&=(999-1)(999+1) + 1\\ | |
&=998\cdot 1000 + 1\\ | |
&=998000 + 1\\ | |
&=998001 |
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
""" | |
computing partial sums | |
for a multiplication | |
""" | |
def updict(v,p,d): | |
if p in d: | |
d[p].append(v) | |
else: |
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
#Συναισθήματα χαράς και λείπεις | |
#Μου λύπης! | |
#@dnikolos | |
removeProblems = { | |
"ου":"ΟΥ", | |
"ού":"ΟΎ", | |
"αυ":"ΑΥ", | |
"αύ":"ΑΎ", | |
"ευ":"ΕΥ", |
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 math | |
def einaiTetragwnos(x): | |
if math.sqrt(x) == int(math.sqrt(x)): | |
return(True) | |
else: | |
return(False) | |
for a in range(-3,3): | |
for b in range(-3,3): | |
for g in range(-3,3): |
OlderNewer