Skip to content

Instantly share code, notes, and snippets.

# -*- 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/"
s = input().strip()
print(len([x for x in s if x.isupper()]) + (1 if not s[0].isupper() else 0))
#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',
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:
# -*- 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
@dimnikolos
dimnikolos / sameFunctions.py
Last active April 26, 2017 08:08
Frequency distribution of processes
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'])
\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
"""
computing partial sums
for a multiplication
"""
def updict(v,p,d):
if p in d:
d[p].append(v)
else:
@dimnikolos
dimnikolos / mouLyphs.py
Last active February 13, 2018 07:56
Ομόηχα
#Συναισθήματα χαράς και λείπεις
#Μου λύπης!
#@dnikolos
removeProblems = {
"ου":"ΟΥ",
"ού":"ΟΎ",
"αυ":"ΑΥ",
"αύ":"ΑΎ",
"ευ":"ΕΥ",
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):