Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions sarikasama/0000/0000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
#Add a number on my icon with the name "icon.png".
#My icon is a little ... big.
#Problem0000

from PIL import Image, ImageDraw, ImageFont

def add_number(num):
im = Image.open("icon.png")
#make a image for showing the number
txt = Image.new('RGBA', im.size, (255,255,255,0))
#use the font "arial.ttf"
fnt = ImageFont.truetype("arial.ttf",40)
#draw context
d = ImageDraw.Draw(txt)
#draw the number
d.text((im.size[0]-50 ,5), str(num), font=fnt, fill=(255,0,0,255))

out = Image.alpha_composite(im, txt)
out.show()
out.save("icon_"+str(num)+".png")

if __name__ == '__main__':
add_number(42)
Binary file added sarikasama/0000/arial.ttf
Binary file not shown.
Binary file added sarikasama/0000/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sarikasama/0000/icon_42.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions sarikasama/0001/0001.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
#generate 200 activation codes for my apple store app

import random, string

def gene_activation_code(count, length):
#make sure codes are diffrent
res = set()
while len(res) < count:
res.add(''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length)))
return res

if __name__ == "__main__":
res = gene_activation_code(200, 8)
f = open("codes","w")
f.write("\n".join(res))
f.close()
200 changes: 200 additions & 0 deletions sarikasama/0001/codes
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
9HM28I2V
YUTUSWLX
KO910ZXR
1XQ7OMTH
R8B8XWT3
CAZDMATI
HNHAU3QA
VR2A5O8L
1A2TG34C
X3JT0T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9HM2HB
1873CQQ8
KGL61SL7
TU41J8F4
U1UCSYE5
4L45MMQ9
MFQLY7CB
MKFH50ZZ
LQ44DAW9
8599GTIB
IGCT34SA
Q39B1TOJ
LANF45HH
72PJTWPK
F0XPL1ZO
5U7KOGZ9
6M1MMXZ1
HVZQD6RB
H2D50E2W
WJEXAK1L
I4CBC1W5
X9XRXBS3
DBNDT60B
6C6QJW0V
H8J8ZW8D
64MUB2X0
8R44E4P9
R83AV775
UBRSJBPF
JN36LDJW
3C2EEMIQ
HRE1S0SK
SH8QH70P
3BI5Q1ZF
1VAQQXA0
QGY6Y7G6
1QQ9FLV7
AP1SNJP2
G68VA57Y
N6UHT54O
7Q9BB5JL
B4PIP9CJ
BAS3O1FH
L6Q6YVSH
APRT16IN
K4205WGU
R00E9H6L
6MW091Y5
ERCE510B
U8XKOESQ
1YAXZEFB
KESINTFI
03DUWJYK
VRFUU0ZR
F5E4B6FX
XSEBU1JQ
3E692DCL
SF5A49NX
7P73NY4S
FAI8YPYC
TDA6FHLT
1NIX4S8W
R549CDKZ
CHK907PO
5S8BU9CN
XJIK45B5
PK1PKL3K
UDU54DY7
G863ES4G
GNW10XUX
FEBRWV5F
88I6TN3R
23 changes: 23 additions & 0 deletions sarikasama/0004/0004.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
#count words in a textfile

from pprint import pprint
import re

def main():
res = {}
with open('test','r') as f:
content = f.read()
tmp = re.split(r"[^a-zA-Z]",content)
for w in tmp:
if not w:
continue
w = w.lower()
if w not in res:
res[w] = 1
else:
res[w] += 1
pprint(res)

if __name__ == "__main__":
main()
107 changes: 107 additions & 0 deletions sarikasama/0004/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{'a': 5,
'about': 1,
'age': 1,
'all': 1,
'always': 2,
'an': 1,
'and': 1,
'arms': 1,
'as': 2,
'at': 4,
'been': 1,
'before': 1,
'born': 1,
'but': 1,
'by': 1,
'can': 1,
'child': 1,
'count': 1,
'did': 3,
'dolly': 1,
'dolores': 1,
'dotted': 1,
'down': 1,
'envied': 1,
'exhibit': 1,
'fact': 1,
'fancy': 1,
'feet': 1,
'fire': 1,
'for': 1,
'four': 1,
'gentlemen': 1,
'girl': 1,
'had': 1,
'have': 2,
'i': 1,
'in': 6,
'indeed': 1,
'initial': 1,
'is': 1,
'jury': 1,
'ladies': 1,
'lee': 2,
'life': 1,
'light': 1,
'line': 1,
'lo': 4,
'loins': 1,
'lola': 1,
'lolita': 4,
'look': 1,
'loved': 1,
'many': 1,
'might': 1,
'misinformed': 1,
'morning': 1,
'murderer': 1,
'my': 6,
'no': 1,
'noble': 1,
'not': 1,
'number': 1,
'of': 7,
'oh': 1,
'on': 3,
'one': 3,
'palate': 1,
'plain': 1,
'point': 1,
'precursor': 1,
'princedom': 1,
'prose': 1,
'school': 1,
'sea': 1,
'seraphs': 2,
'she': 8,
'simple': 1,
'sin': 1,
'slacks': 1,
'sock': 1,
'soul': 1,
'standing': 1,
'steps': 1,
'style': 1,
'summer': 2,
'ta': 2,
'taking': 1,
'tangle': 1,
'tap': 1,
'teeth': 1,
'ten': 1,
'that': 1,
'the': 10,
'there': 1,
'this': 1,
'thorns': 1,
'three': 2,
'tip': 1,
'to': 1,
'tongue': 1,
'trip': 1,
'was': 7,
'what': 1,
'when': 1,
'winged': 1,
'years': 1,
'you': 1}
1 change: 1 addition & 0 deletions sarikasama/0004/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lolita, light of my life, fire of my loins. My sin, my soul. Lo-lee-ta: the tip of the tongue taking a trip of three steps down the palate to tap, at three, on the teeth. Lo. Lee. Ta. She was Lo, plain Lo, in the morning, standing four feet ten in one sock. She was Lola in slacks. She was Dolly at school. She was Dolores on the dotted line. But in my arms she was always Lolita. Did she have a precursor? She did, indeed she did. In point of fact, there might have been no Lolita at all had I not loved, one summer, an initial girl-child. In a princedom by the sea. Oh when? About as many years before Lolita was born as my age was that summer. You can always count on a murderer for a fancy prose style. Ladies and gentlemen of the jury, exhibit number one is what the seraphs, the misinformed, simple, noble-winged seraphs, envied. Look at this tangle of thorns.
18 changes: 18 additions & 0 deletions sarikasama/0005/0005.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
#change the resolution of pics in dir 'test' to at most 1136*640 for iphone5
from PIL import Image
import os

def main():
os.chdir('test')
for root,dirs,files in os.walk(os.getcwd()):
for f in files:
im = Image.open(f)
if im.size[0] > 1136:
im.resize([1136,im.size[1]])
if im.size[1] > 640:
im.resize([im.size[0],640])
im.save('test_'+im.filename)

if __name__=='__main__':
main()
Loading