This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | Example | # sets | Characters | Escapes | | |
|-----------------|-------------|------------|-------------|-------------------------| | |
| Character | 'H' | 0 | All Unicode | Quote & ASCII & Unicode | | |
| String | "hello" | 0 | All Unicode | Quote & ASCII & Unicode | | |
| Raw string | r#"hello"# | 0 or more* | All Unicode | N/A | | |
| Byte | b'H' | 0 | All ASCII | Quote & Byte | | |
| Byte string | b"hello" | 0 | All ASCII | Quote & Byte | | |
| Raw byte string | br#"hello"# | 0 or more* | All ASCII | N/A | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create an UDP server using nc on port 11090 | |
nc -ul 11090 | |
# check whether an UDP server is listening on 11190 | |
nc -vz -u <hostname> 11090 | |
# send a packet to the UDP server | |
echo -n "hello" | nc -4u -w1 <hostname> 1118 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Context manager definition | |
class FileOpen(object): | |
def __init__(self, file_name, method): | |
self.file_object = open(file_name, method) | |
def __enter__(self): | |
return self.file_object | |
def __exit__(self, value, type, traceback): | |
self.file_object.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = open("hello.csv", "w") | |
try: | |
file.write('I am a disco dancer') | |
finally: | |
file.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const foo = () => console.log("First"); | |
const bar = () => setTimeout(() => console.log("Second")); | |
const baz = () => console.log("Third"); | |
bar(); | |
foo(); | |
baz(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numbers = [1, 2, 3]; | |
numbers[10] = 11; | |
console.log(numbers); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
let x, y; | |
try { | |
throw new Error(); | |
} catch (x) { | |
(x = 1), (y = 2); | |
console.log(x); | |
} | |
console.log(x); | |
console.log(y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[0, 1], [2, 3]].reduce( | |
(acc, cur) => { | |
return acc.concat(cur); | |
}, | |
[1, 2] | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!null; | |
!!""; | |
!!1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[..."Asnim"]; |
NewerOlder