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
Language:
py3


Source:
input_text = '#hello 123\n bobin!!!   \n:D'
r=range(65,90)
mapped = dict(list(zip(r, range(0x1F1E6,0x1F1FF)))+[(32,32)])
gen = [chr(mapped[ord(x)]) if ord(x) in r else x for x in input_text.upper()]
print(*gen,sep='\u200b')


Result:
#โ€‹๐Ÿ‡ญโ€‹๐Ÿ‡ชโ€‹๐Ÿ‡ฑโ€‹๐Ÿ‡ฑโ€‹๐Ÿ‡ดโ€‹ โ€‹1โ€‹2โ€‹3โ€‹
โ€‹ โ€‹๐Ÿ‡งโ€‹๐Ÿ‡ดโ€‹๐Ÿ‡งโ€‹๐Ÿ‡ฎโ€‹๐Ÿ‡ณโ€‹!โ€‹!โ€‹!โ€‹ โ€‹ โ€‹ โ€‹
โ€‹:โ€‹๐Ÿ‡ฉ
Language:
py3


Source:
male = "โ™‚๏ธ"
female = "โ™€๏ธ"
man = "๐Ÿ’โ€โ™‚๏ธ"
trans = man.translate(man.maketrans(male, female))
neutral = trans[:-3]
print(man, trans, neutral, sep="\n")


Result:
๐Ÿ’โ€โ™‚๏ธ
๐Ÿ’โ€โ™€๏ธ
๐Ÿ’
Language:
py3


Source:
man = '๐Ÿ’โ€โ™‚๏ธ'

_=man.translate

trans = _(\
man.maketrans('โ™‚๏ธ','โ™€๏ธ'))

neutral = trans[:-3]

print(man, trans, neutral)


Result:
๐Ÿ’โ€โ™‚๏ธ ๐Ÿ’โ€โ™€๏ธ ๐Ÿ’
import re
from string import printable as pr

p=pr[10:]+'0123456789'
extra = len(p) % 16
if extra > 0:
p = p + ("\x00" * (16 - extra))
spl = re.findall("(.{1,16})", p, flags=re.DOTALL)[0]

inp = "helloo"

jnd=''.join([str(hex(spl.find(x))).split('x')[1] for x in inp])
spl2= re.findall("(.{2})", jnd, flags=re.DOTALL)
jnd2=''.join([chr(int(x, 16)) for x in spl2])
print('Input text: ', inp, '\nCompressed: ', jnd2, '\nSavings: ', int((len(inp)/len(jnd2))*100), '%', sep='')

djnd=[str(hex(ord(x))).split('x')[1] for x in jnd2]
dcd=[spl[int(x[0],16)]+spl[int(x[1],16)] for x in djnd]
print('Decompressed: ', *dcd, sep='')
Language:
py3


Source:
class Boat():
def __init__(s):pass
@staticmethod
def build():
return " ๐Ÿšฉ\n\___/"

boat = Boat()
print(boat.build())


Result:
  ๐Ÿšฉ
\___/
Language:
py3


Source:
a,x,y,z,j,k,b,m=1,5.5,0,2,3,5,4,0
while y<((a*a)/z+(a*z))*(x*z)*j+k:y+=a;
while m<(b*((a+a)*j*j-a)):m+=b;
print(''.join(map(chr,[int(m*((int(str(k+a)+str(j)+"0")+a)*j+(a/b)))])))


Result:
๐Ÿ›ฅ
๐Ÿ˜ข1
Forwarded from Zac
Language:
py3


Source:
from string import printable
fancy_code = """๐“…๐“‡๐’พ๐“ƒ๐“‰("๐ป๐‘’๐“๐“๐‘œ, ๐“Œ๐‘œ๐“‡๐“๐’น!")"""

d = dict(zip("""๐Ÿข๐Ÿฃ๐Ÿค๐Ÿฅ๐Ÿฆ๐Ÿง๐Ÿจ๐Ÿฉ๐Ÿช๐Ÿซ๐’ถ๐’ท๐’ธ๐’น๐‘’๐’ป๐‘”๐’ฝ๐’พ๐’ฟ๐“€๐“๐“‚๐“ƒ๐‘œ๐“…๐“†๐“‡๐“ˆ๐“‰๐“Š๐“‹๐“Œ๐“๐“Ž๐“๐’œ๐ต๐’ž๐’Ÿ๐ธ๐น๐’ข๐ป๐ผ๐’ฅ๐’ฆ๐ฟ๐‘€๐’ฉ๐’ช๐’ซ๐’ฌ๐‘…๐’ฎ๐’ฏ๐’ฐ๐’ฑ๐’ฒ๐’ณ๐’ด๐’ต""", printable))

exec(''.join([d[x] if x in d else x for x in fancy_code]))


Result:
Hello, world!
Input:
"".join(sorted("Zac", key=ord))

Output:
Zac

Printed:
``
Forwarded from davide
Language:
py3


Source:
f,r,a,n,c,e = (*"franc"#e
,print)
a = "".join((f,r,a))
f;r;a;n;c;e(
fr"{a}nce"
)


Result:
france
Forwarded from davide
Language:
py3


Source:
noreply,gmail=type("",(type,),{"__matmul__":lambda*_:print(f"{_[0].__name__}@{_[1]}")})("noreply",(),{}),type("",(),{"com":"gmail.com"})

noreply@gmail.com


Result:
noreply@gmail.com
Forwarded from Zac
Language:
py3


Source:
class _():
def __init__(__,_):__(_)
def __call__(__,_):print(_);return __
_('a')('b')('c')('d')('e')('f')


Result:
a
b
c
d
e
f
Exec Source:
code = """class _():
def __init__(__,_):__(_)
def _(__,_=''):return __(' '+_)
def __call__(__,_):print(_, end='');return __"""

text = str(code)
final = f"""{code}\n_{''.join([f"({repr(c)})" if c!=' ' else "._()" for c in text.strip()])}"""
print(final, '\n')
exec(final)
return AsyncNone

Result:
class _():
def __init__(__,_):__(_)
def _(__,_=''):return __(' '+_)
def __call__(__,_):print(_, end='');return __
_('c')('l')('a')('s')('s')._()('_')('(')(')')(':')('\n')._()._()._()._()('d')('e')('f')._()('_')('_')('i')('n')('i')('t')('_')('_')('(')('_')('_')(',')('_')(')')(':')('_')('_')('(')('_')(')')('\n')._()._()._()._()('d')('e')('f')._()('_')('(')('_')('_')(',')('_')('=')("'")("'")(')')(':')('r')('e')('t')('u')('r')('n')._()('_')('_')('(')("'")._()("'")('+')('_')(')')('\n')._()._()._()._()('d')('e')('f')._()('_')('_')('c')('a')('l')('l')('_')('_')('(')('_')('_')(',')('_')(')')(':')('p')('r')('i')('n')('t')('(')('_')(',')._()('e')('n')('d')('=')("'")("'")(')')(';')('r')('e')('t')('u')('r')('n')._()('_')('_')

class _():
def __init__(__,_):__(_)
def _(__,_=''):return __(' '+_)
def __call__(__,_):print(_, end='');return __
๐Ÿคฏ1
Dyslexia Regex

Minified version (only PCREBot compatible):
s/(?i)(((?<V>[aeiou]|(?<![aeiou])y(?![aeiou]))|(\B\g<V>))(\g<V>)(?<C>[^aeiouy .,'"\n()\[\]{}])((\g<V>)([^aeiouy .,]\B))|(\B(\g<V>)|(\B\g<V>))(\g<V>)([^aeiouy .,]))|((\g<C>)(\g<C>)(\g<V>)(\g<V>))|(\b\g<C>)(\g<V>)(\g<V>)(\g<C>\b)/\3\6\5\9\8\11\14\13\16\18\17\19\20\21\23\22


Engine: PCRE
Flags: global, ignore-case

Parts of the above pattern commented:
V = Vowel
C = Consonant

===VVCVC?= or
==?VVCVC?=
(((?<VOWEL>[aeiou]|(?<![aeiou])y(?![aeiou]))|(\B\g<VOWEL>))(\g<VOWEL>)(?<CONS>[^aeiouy .,'"\n()\[\]{}])((\g<VOWEL>)([^aeiouy .,]\B))|

===VVC?== or
==?VVC?==
(\B(\g<VOWEL>)|(\B\g<VOWEL>))(\g<VOWEL>)([^aeiouy .,]))|

===CCVV===
((\g<CONS>)(\g<CONS>)(\g<VOWEL>)(\g<VOWEL>))|

CVVC
(\b\g<CONS>)(\g<VOWEL>)(\g<VOWEL>)(\g<CONS>\b)


Substitution:
$3$6$5$9$8$11$14$13$16$18$17$19$20$21$23$22

Example text:
usually a rounding subroutine

Result:
usulaly a ronuding suborutine
s/(?i)(((?<V>[aeiou]|(?<![aeiou])y(?![aeiou]))|(\B\g<V>))(\g<V>)(?<C>[^aeiouy .,'"\n()\[\]{}])((\g<V>)([^aeiouy .,]\B))|(\B(\g<V>)|(\B\g<V>))(\g<V>)([^aeiouy .,]))|((\g<C>)(\g<C>)(\g<V>)(\g<V>))|(\b\g<C>)(\g<V>)(\g<V>)(\g<C>\b)/\3\6\5\9\8\11\14\13\16\18\17\19\20\21\23\22
Forwarded from tulir
Language:
py3


Source:
rip


Errors:
Rextester api calls require api key. To get one please visit https://www.patreon.com/rextester
R.I.P. Rextesterbot
- 2021
You have been a faithful friend and programming companion, you shall be sorely missed ๐Ÿ˜“
Forwarded from drunktimelord via @iruncode_bot
Language:
c


Code:
main() { int ๐Ÿ† = 5; printf("%d", ๐Ÿ†); }


Output:
5
Forwarded from Zac via @iruncode_bot
Language:
py3


Code:
import random as r;h=r.choice;u=str.upper;l=list;m=map;c,C,v,V=0,1,2,3
def _(b):
c,v='bdfghjklmnprstvwyz','aei'
V,U=f'{b:02b}'
return h(u(v) if int(V) else u(c)) if int(U) else h(v if int(V) else c)
F=[C,v,c,v,c,v]
print(*l(m(_,F)),' ',*l(m(_,F)),sep='')


Output:
Wetiki Mevabi
Forwarded from I Run Code
Language:
py3


Code:
import random as r

# selectable character options for templating words
# note: keys should be a single lowercase string character
options = {
"c": "bdfghjklmnprstvwyz",
"v": "aeio",
"e": ["รจ", "eรจ", "ร ", "aeux"],
"t": ["III", "PhD", "MD", "VII"]}

# the word template layout using above selectable option keys
# note: if you give a value name as a capital letter, the resulting selection will be capitalized
# note 2: keys should be integers
templates = {
1: "Cvvcvcv",
2: "Vccvcv",
3: "Cvcvce t"}

# the printable order of templated words
# note: using template more than once yields a new word each time, following the given template
# note 2: reference to templates should be integers, strings are included as-is
nformat = [1, 2, 3, "son of", 1, "Jr."]

# delimiter between names
delim = ' '

# selects based on option
def select(opt):
try:
k = opt.lower()
c = r.choice(options[k])
except KeyError:
# handle unknown keys as character literals
return opt
cu = c.upper()
return cu if opt.isupper() else c

# template builder
def template_build(format_list):
output = ''
for i, k in enumerate(format_list):
if isinstance(k, str):
if i==0:
output += k
else:
output += delim + k
elif isinstance(k, int):
if i==0:
output += ''.join(map(select, templates[k]))
else:
output += delim
output += ''.join(map(select, templates[k]))
return output

print(template_build(nformat))


Output:
Liokojo Etbipe Vodizaeux MD son of Doibomo Jr.
Forwarded from I Run Code
Language:
py3


Code:
from string import ascii_lowercase as alpha
import random as r
import re
VOWS = 'aeiouy'
CONS = re.sub(f'[{VOWS}]', '', alpha) # todo: fix 'y'
options = {}
def select(opt):
try:
k = opt.lower()
c = r.choice(options[k])
except KeyError:
# handle unknown keys as character literals
return opt
cu = c.upper()
return cu if opt.isupper() else c


def template_build(format_list, templates):
output = ''
for i, k in enumerate(format_list):
if isinstance(k, int):
output += ''.join(map(select, templates[k]))
return output


def classify(phrase):
global options
options = {'c': '','v': '','a': ''}
templates = {}
nformat = []
for i,word in enumerate(phrase):
temp = ''
for chr in word:
lowc = chr.lower()
if lowc in CONS:
if lowc not in options['c']:
options['c'] += lowc
temp += 'C' if chr.isupper() else 'c'
elif lowc in VOWS:
if lowc not in options['v']:
options['v'] += lowc
temp += 'V' if chr.isupper() else 'v'
elif lowc.isalpha(): # other alpha chars
if lowc not in options['a']:
options['a'] += lowc
temp += 'A' if chr.isupper() else 'a'
else: # other special chars
options[chr] = chr
temp += chr
if temp in templates.values():
for k,v in templates.items():
if v==temp:
nformat.append(k)
break
else:
templates[i] = temp
nformat.append(i)
return template_build(nformat, templates)


def main(inp):
print(classify(inp), end='')


if __name__=='__main__':
import sys
lines = sys.stdin.readlines()
if len(lines[0]) > 0:
main(lines)
else:
print('Please enter a phrase to regenerate!')


Stdin:
The Zen of Python, by Tim Peters


Output:
Tzy Tez if Bibnen, bi Mep Bizemt
Can you decipher this?
030.05f.039.05f.030.02d.032.05f.033.05f.030.02d.032.05f.037.05f.030.02d.031.05f.030.05f.031.02d.038.05f.030.05f.031.02d.038.05f.030.05f.031.02d.031.05f.031.05f.031.02d.032.05f.033.05f.030.02d.034.05f.038.05f.030.02d.034.05f.030.05f.031.02d.031.05f.030.05f.031.02d.034.05f.031.05f.031.02d.031.05f.030.05f.031.02d.036.05f.034.05f.030.02d.032.05f.033.05f.030.02d.035.05f.036.05f.030.
The first one to send the fully and correctly deciphered result to @Zacci will be featured on this channel!