ZN Code Saves
20 subscribers
2 photos
2 links
Code snippets and programming notes.

For testing bots and scripts, please join: @botspamdebug

More from ZN: @z_network
Download Telegram
Forwarded from Zac
Language:
py3


Source:
import random as r
c = {1:"",2:"",3:"",4:"💣",5:"",6:""}
print('russian roulette:\n*spin*\n*click*\n')
print("*bang*\n*ded*" if not c[r.choice(list(c.keys()))] == "" else ":) *yolo*")


Result:
russian roulette:
*spin*
*click*

:) *yolo*
Forwarded from Zac
Language:
py3


Source:
import random as r
c = {1:"",2:"",3:"",4:"💣",5:"",6:""}
print('russian roulette:\n*spin*\n*click*\n')
print("*bang*\n*ded*" if not c[r.choice(list(c.keys()))] == "" else ":) *yolo*")


Result:
russian roulette:
*spin*
*click*

*bang*
*ded*
Language:
py3


Source:
o,h,e,q,c,k='•','<','no he*cks given.',7,13,'—';d=['⠀']*c;v=['']*q;p=[[i for i in d] for j in v];p[0][6]=p[1][3]=p[1][9]=p[3][1]=p[3][11]=p[5][0]=p[5][6]=p[5][12]=o;p[5][2]=h;p[5][3]=p[5][4]=p[5][5]=k;
print(*[''.join(x) for x in p],e, sep='\n')


Result:
⠀⠀⠀⠀⠀⠀•⠀⠀⠀⠀⠀⠀
⠀⠀⠀•⠀⠀⠀⠀⠀•⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀•⠀⠀⠀⠀⠀⠀⠀⠀⠀•⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
•⠀<———•⠀⠀⠀⠀⠀•
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
no he*cks given.
Language:
py3


Source:
o,h,e,q,c,k='🔹','◁','no he*cks.',7,13,'—';d=['⠀']*c;v=['']*q;p=[[i for i in d] for j in v];p[1][6]=p[2][2]=p[2][9]=p[3][1]=p[3][10]=p[4][0]=p[4][11]=p[5][0]=p[5][10]=o;p[5][2]=h;p[5][3]=p[5][4]=p[5][5]=k;p[5][6]='▫️'
print(*[''.join(x) for x in p],e, sep='\n')


Result:
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀🔹⠀⠀⠀⠀⠀⠀
⠀⠀🔹⠀⠀⠀⠀⠀⠀🔹⠀⠀⠀
🔹⠀⠀⠀⠀⠀⠀⠀⠀🔹⠀⠀
🔹⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀🔹
🔹⠀◁———▫️⠀⠀⠀🔹⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
no he*cks.
Language:
py3


Source:
h,t,g,o,s,n= ['🍺', '🍪', '🌮'],'🗑️','< (^_^ <)','(> ^_^) >','⠀','\n\n';d=len(h)
for i in reversed(range(d)):
z=[[*h,s,g,s,t],[*h,g,s,s,t],[*h[:i],o,h[i],s,t],[*h[:i],s,o,h[i],t],[*h[:i],s,s,o,t],[*h[:i],s,s,g,t]];print(*[''.join(x) for x in z],sep=n);h[i]=''


Result:
🍺🍪🌮⠀< (^_^ <)⠀🗑️

🍺🍪🌮< (^_^ <)⠀⠀🗑️

🍺🍪(> ^_^) >🌮🗑️

🍺🍪⠀(> ^_^) >🌮🗑️

🍺🍪⠀⠀(> ^_^) >🗑️

🍺🍪⠀⠀< (^_^ <)🗑️
🍺🍪⠀< (^_^ <)⠀🗑️

🍺🍪< (^_^ <)⠀⠀🗑️

🍺(> ^_^) >🍪🗑️

🍺⠀(> ^_^) >🍪🗑️

🍺⠀⠀(> ^_^) >🗑️

🍺⠀⠀< (^_^ <)🗑️
🍺⠀< (^_^ <)⠀🗑️

🍺< (^_^ <)⠀⠀🗑️

(> ^_^) >🍺🗑️

⠀(> ^_^) >🍺🗑️

⠀⠀(> ^_^) >🗑️

⠀⠀< (^_^ <)🗑️
s/(?<![ls ])c(?![hkt ])|s/th/gi
Language:
py3


Source:
t,g,o,s,c,n,m,w='🗑','<(^_^ <)','(> ^_^)>','⠀','⠀⠀','\n\n',-1,' ';h='💰',w,'🔧';d=len(h)
for i in range(d+m,m,m):
j,k=h[i],h[:i]
if j==w:h=k;continue
print(*[''.join(x) for x in (h+(s,g,s,t),h+(g,c,t),k+(o,j,s,t),k+(s,o,j,t),k+(c,o,t),k+(c,g,t))],sep=n);h=k


Result:
💰 🔧⠀<(^_^ <)⠀🗑

💰 🔧<(^_^ <)⠀⠀🗑

💰 (> ^_^)>🔧🗑

💰 ⠀(> ^_^)>🔧🗑

💰 ⠀⠀(> ^_^)>🗑

💰 ⠀⠀<(^_^ <)🗑
💰⠀<(^_^ <)⠀🗑

💰<(^_^ <)⠀⠀🗑

(> ^_^)>💰🗑

⠀(> ^_^)>💰🗑

⠀⠀(> ^_^)>🗑

⠀⠀<(^_^ <)🗑
from collections import Counter
n='Alexandru Popescu'
L,v=n.upper().replace(' ',''),reversed
c=Counter(L)
T=sorted([(k,c[k]) for k in c.keys() if c[k]>1], key=lambda e:(e[1],e[0]))
if not T:T=[(L)]
j=['-'.join(v([p[0]+str(p[1]) for p in T if p[1]>T[0][1]]))]
if j[0]=='':j=[T[-1][0]+str(T[-1][1])]
m=''.join(v([x[0] for x in T if x[1]==T[0][1]]))
print (*j+[m] if len(j)>2 else j+['-']+[m[1:4] if len(m)>2 else m[1:4]+'O'],sep='')
def droid_name_gen(name):
n=__import__('re').sub('[^\\w]','',str(name))
if not n:return "Name Invalid.\nR2-D2: sad beep x'("
L=n.upper()
v=reversed
c=__import__('collections').Counter(L)
T=sorted([(k,c[k]) for k in c.keys() if c[k]>1], key=lambda e:(e[1],e[0]))
if T==[]:T=[(L[0],str(len(L))[0], (L[-1]))]
j=['-'.join(v([p[0]+str(p[1]) for p in T if p[1]>=T[0][1]]))]
jf=j[0][:2]
if len(j[0])==5:
if jf[1]==j[0][4]:j=[j[0][:5]]
elif len(j[0])>=8:
if jf[1]==j[0][4]:j=[j[0][:5]]
elif j[0][4] == j[0][7]:j=[j[0][:2]]
elif j[0]=='':j=[T[-1][0]+str(T[-1][1])]
m=''.join(v([x[0] for x in T if x[1]<=T[0][1]]))
e=j if len(j[0])>=5 else (j+['-']+[(m[1:4]) if len(m)>2 else (m[1:4]+('O' if len(m)>1 else 'O'+str(T[-1][-1])))])
return ''.join(e)

if __name__=="__main__":
import sys
if len(sys.argv)>1:
print(droid_name_gen(''.join([str(x) for x in sys.argv[1:]])))
else:
print("Please enter a name")
s/((([aeiou]|(?<![aeiou])y(?![aeiou]))|(\B[aeiou]|(?<![aeiou])y(?![aeiou])))([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,'"\n()\[\]{}])(([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,]\B))|(\B([aeiou]|(?<![aeiou])y(?![aeiou]))|(\B[aeiou]|(?<![aeiou])y(?![aeiou])))([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,]))|(([^aeiouy .,'"\n()\[\]{}])([^aeiouy .,'"\n()\[\]{}])([aeiou]|(?<![aeiou])y(?![aeiou]))([aeiou]|(?<![aeiou])y(?![aeiou])))|(\b[^aeiouy .,'"\n()\[\]{}])([aeiou]|(?<![aeiou])y(?![aeiou]))([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,'"\n()\[\]{}]\b)/\3\6\5\9\8\11\14\13\16\18\17\19\20\21\23\22/gi
group_of_groups = [['telethonchat','telethonofftopic'],['pyrogramchat','pyrogramlounge']]
all_dict,common = {},[]
for index, group_group in enumerate(group_of_groups):
all_dict[str(index)] = []
for group in group_group:
lst1 = client.iter_chat_members(group)
for user in lst1:
first = user.user.first_name
username = user.user.username or ' '
un = f'@{username}:' if username!=' ' else ''
last = user.user.last_name or ' '
uid = user.user.id
user_form = f'{un}{uid}:{first} {last}'
all_dict[str(index)].append(user_form)
keys_list = list(all_dict.keys())
for index,group_group1 in enumerate(keys_list):
for group_group_user1 in all_dict[group_group1]:
for group_group2 in keys_list[index+1:]:
for group_group_user2 in all_dict[group_group2]:
if group_group_user1 == group_group_user2 and group_group_user1 not in common:
common.append(group_group_user1)
with open ('list_common.txt', 'w') as f:
f.write('\n'.join([x for x in common]))
client.send_document(mcid, 'list_common.txt')
Language:
py3


Source:
from datetime import datetime as z
a,b,o=60,2020,divmod
y=z(b,1,1)-z.utcnow()
x=y.seconds
m,s=o(x,a)
h,m=o(m,a)
print('UTC is {} in {}{}h {}m {}s '.format(b,str(y).split(',')[0]+', ' if ',' in str(y) else '',h,m,s)[:11 if x<1 else -1])


Result:
UTC is 2020 in 232 days, 10h 36m 40s
apt update && apt install clang lib{jpeg-turbo,webp}-dev python{,-dev} zlib-dev && pip install -U setuptools && pip install -U telethon cryptg pillow
Forwarded from Zac
Assigns branch:
s/^(?=(\s+).+\n)/┣/gm

Assigns last branch symbol:
s/(?<=[\n])\s(?=\s*\w)/┗/

Assigns tab indents:
s/(?<!:)[^\S\r\n]/━/g
Forwarded from Zac
Language:
py3


Source:
import re
text="""MainThing:
key: value
subkey: value
subsub: value"""

regs=[(r"(?m)^(?=(\s+).+\n)","┣"),(r"(?<=[\n])\s(?=\s*\w)","┗"), (r"(?<!:)[^\S\r\n]","━")]

for x in regs:
text=re.sub(*x, text)
print(text)


Result:
MainThing:
┣━key: value
┣━━subkey: value
┗━━━subsub: value
Forwarded from Zac
Language:
py3


Source:
__, ς=['(*__*  ς)'],1

print(*__* ς)


Result:
(*__*  ς)
Forwarded from Zac
Language:
py3


Source:
([],__,[],  ς)   ='',\
\
['(*__* ς)'] ,'',1

print(*__* ς)


Result:
(*__*  ς)
Forwarded from Zac
Language:
py3


Source:
from random import choice as c
a=['an','a','the']
x1a,x2n,x3v,x4p,x5a,x6n=a,['cat','man','shark'],['sat','fell','died'],['in','on','under'],a,['mat','table','ocean']
print(*list(map(c,[x[1] for x in sorted([(k,v) for k,v in locals().items() if 'x' in k])])))


Result:
a shark sat on the ocean
Forwarded from Deleted Account
alias please="sudo"
alias killme="rm -rf /*"

$ please killme
Forwarded from Zac
Language:
py3


Source:
import os, re
from random import random
ran=list(os.urandom(1000))
ranm=''.join(list(map(chr,ran)))
pos=['[^a-z]','(bx|dx|fx|g[qx]|hx|j[cqxz]|kx|mx|q[cdfgjkmnptz]|sx|v[bjqwx]|wx|zx)']
for r in pos:
ranm=re.sub(r,'',ranm)
f=re.findall('\w{5}',ranm)
print(*f)


Result:
yjrjr ekgnu xtzcl ttipr niinl grype dzhzw erlvm infaq ljofp lxgvf jgkbn qrmkm ipovm gtlan vcmll
Language:
py3


Source:
import os, re
from random import random
ran=list(os.urandom(2000))
ranm=''.join(list(map(chr,ran)))
pos=['[^a-z]','(bx|dx|fx|g[qx]|hx|j[cqxz]|kx|mx|q[cdfgjkmnptz]|sx|v[bjqwx]|wx|zx)']
for r in pos:
ranm=re.sub(r,'',ranm)
f=re.findall('\w{3}',ranm)
print(*f)


Result:
bzz urx hek vsr jhb ryz qox bkk cuc jwm ine hdc ybo orl kur typ bvg car pwy adj jye fqs eqx uqu wlx bax kms pyw iwu ofl lca zdk osl ipu hob yrx kuh qaq xdl fus ypl lax wgc sdc qbk lxv pco bor kvt cba jhb svd iwa tsj spr zac dbv uit xkf lui mtb tjf