Skip to content

Instantly share code, notes, and snippets.

View ibehnam's full-sized avatar
:dependabot:
prompting ChatGPT

Behnam Moh ibehnam

:dependabot:
prompting ChatGPT
View GitHub Profile
class example:
def __init__(self):
self.name = 'dummy example'
def bigNumber(self, number):
return number * 1000000000
e = example()
e.name # 'dummy example'
e.bigNumber(5) # 5000000000
print('{:_}'.format(e.bigNumber(5))) # 5_000_000_000
l # (1, 2, 3, 4)
k = (1, 2, 4, 3)
l == k # False
l.__eq__(k) # False
class BetterAddition:
def __init__(self, arg):
assert arg
match arg:
case str(): self.strVal = arg
case int(): self.intVal = arg
case _: print('int or str only')
def __add__(self, other):
assert other
# --------------------------------- For Gist --------------------------------- #
alias ,gpy="gist --type 'py' --copy --skip-empty --paste"
alias ,gtxt="gist --type 'txt' --copy --skip-empty --paste"
l = (1, 2, 3, 4,)
@ibehnam
ibehnam / foo.py
Last active October 21, 2022 20:18
l.count(3) # 1
from inspect import getmembers
getmembers(l)
[('__add__', <method-wrapper '__add__' of tuple object at 0x7ff121d20860>),
('__class__', tuple),
('__class_getitem__', <function tuple.__class_getitem__>),
('__contains__',
<method-wrapper '__contains__' of tuple object at 0x7ff121d20860>),
('__delattr__',
<method-wrapper '__delattr__' of tuple object at 0x7ff121d20860>),
('__dir__', <function tuple.__dir__()>),
('__doc__',
"Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object."),
@ibehnam
ibehnam / My Karabiner.json
Last active July 20, 2022 18:09
My Karabiner-Elements
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@ibehnam
ibehnam / Spotify's Commands in its SDEF file.xml
Created July 17, 2022 17:36
Spotify's Commands in its SDEF file
<command name="next track" code="spfyNext" description="Skip to the next track.">
<access-group identifier="com.spotify.playback"/>
<cocoa class="SPNextTrackScriptCommand"/>
</command>
<command name="previous track" code="spfyPrev" description="Skip to the previous track.">
<access-group identifier="com.spotify.playback"/>
<cocoa class="SPPreviousTrackScriptCommand"/>
</command>
<command name="playpause" code="spfyPlPs" description="Toggle play/pause.">
<access-group identifier="com.spotify.playback"/>