Skip to content

Instantly share code, notes, and snippets.

@stsynguev
Created October 26, 2018 03:55
Show Gist options
  • Save stsynguev/988903cc451eea1f40b3d14fa4637157 to your computer and use it in GitHub Desktop.
Save stsynguev/988903cc451eea1f40b3d14fa4637157 to your computer and use it in GitHub Desktop.
FaroffBrownAddon created by SaianTsynghuiev - https://repl.it/@SaianTsynghuiev/FaroffBrownAddon
Empty file
!
service timestamps debug datetime msec localtime show-timezone year
service timestamps log datetime msec localtime show-timezone year
service password-encryption
service sequence-numbers
!
no ip domain lookup
!
ip ssh version 2
!
h1 = 'привет'
print(h1)
print(type(h1))
print("\N{LATIN SMALL LETTER O WITH DIAERESIS}")
print("\u00F6")
hi1 = 'привет'
hi2 = '\u043f\u0440\u0438\u0432\u0435\u0442'
print(hi2)
print(hi1 == hi2,len(hi2))
print(ord('ö'))
print(chr(246))
b1 = b'\xd0\xb4\xd0\xb0'
b2 = b"\xd0\xb4\xd0\xb0"
b3 = b'''\xd0\xb4\xd0\xb0'''
print('{} {}'.format(type(b3),len(b3)))
bytes1 = b'Hello'
print(bytes1)
print(bytes1.hex())
bytes2 = b'\x48\x65\x6c\x6c\x6f'
print(bytes2)
hi = 'привет'
print(hi.encode('utf-8'))
hi_bytes = hi.encode('utf-8')
print(hi_bytes.decode('utf-8'))
''' str.encode, bytes.decode'''
print(hi)
print(str.encode(hi,'utf-8'))
print(hi_bytes)
print(bytes.decode(hi_bytes,'utf-8'))
'''decode bytes to unicode at start of the program code, do operations, and at the last part of program encode unicode to bytes '''
import subprocess as sp
result = sp.run(['ping','-c','3','-n','8.8.8.8'],stdout=sp.PIPE,encoding='utf-8')
print(result.stdout)
import pexpect as p
output = p.run('ls -ls',encoding='utf-8')
print(output)
with open('r1.txt',encoding='utf-8') as f:
for line in f:
print(line,end='')
print(hi_bytes.decode('utf-16'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment