Skip to content

Instantly share code, notes, and snippets.

View tebeka's full-sized avatar
💭
alive

Miki Tebeka tebeka

💭
alive
View GitHub Profile
@tebeka
tebeka / 2.go
Created September 15, 2022 14:44
type slice struct {
array unsafe.Pointer
len int
cap int
}
@tebeka
tebeka / 1.go
Created September 15, 2022 14:44
cart := []string{"apple", "pear", "milk"}
fruits := cart[:2]
fruits = append(fruits, "lemon")
fmt.Println("cart:", cart, "fruits:", fruits)
[DEBUG] year -> 2022
2022
from datetime import datetime
class LoggingProxy:
"""Log attribute access to proxied object."""
def __init__(self, obj):
self._obj = obj
def __getattr__(self, attr):
val = getattr(self._obj, attr, None)
from datetime import datetime
class LoggingProxy:
"""Log attribute access to proxied object."""
def __init__(self, obj):
self._obj = obj
def __getattribute__(self, attr):
val = getattr(self._obj, attr, None)
#!/bin/bash
case $1 in
-h | --help ) echo "usage: $(basename $0) [VERSION]"; exit;;
esac
if [ $# -gt 1 ]; then
1>&2 echo "error: wrong number of argument"
exit 1
fi
haystack = "Where's Wally?"
needle = 'Waldo'
if needle in haystack:
print('Found Waldo')
else:
print('Waldo not found')
Found Waldo
haystack = "Where's Wally?"
needle = 'Waldo'
if haystack.find(needle):
print('Found Waldo')
else:
print('Waldo not found')
arr := [...]string{"A", "B", "C"}
fmt.Println(len(arr)) // 3