Skip to content

Instantly share code, notes, and snippets.

View lig's full-sized avatar
🛴
kicking it

Serge Matveenko lig

🛴
kicking it
View GitHub Profile
@lig
lig / super.py
Last active May 14, 2020 12:13
super() outside of a class
>>> class A:
... def foo(self):
... return 5
>>> class B(A):
... def foo(self):
... return 3
>>> b = B()
@lig
lig / commit.py
Created March 30, 2020 09:15
pygit2 create commit simple
import pygit2
repo = pygit2.Repository(path='.')
repo.index.add_all()
repo.index.write()
tree = repo.index.write_tree()
parent, ref = repo.resolve_refish(refish=repo.head.name)
repo.create_commit(

Keybase proof

I hereby claim:

  • I am lig on github.
  • I am lig (https://keybase.io/lig) on keybase.
  • I have a public key whose fingerprint is 1F69 B222 54B1 020E 376E A124 7975 FCE7 7887 3B13

To claim this, I am signing this object:

@lig
lig / gitmoji.tsv
Last active April 16, 2019 08:30
The gitmoji set for emoji-cli
art structure,format
zap performance,optimization
fire burn,remove,discard
bug bug,fix
ambulance critical,hotfix
sparkles new,feature
memo memo,docs,readme,note
rocket deploy,ship
lipstick ui,style
tada initial,first,init
@lig
lig / f.pyx
Created April 10, 2018 09:55
Nasty f-string hacks
In [1]: foo = {}
In [2]: f'r u a hacker or wat? {foo.update(a=1)} {locals().update(b="ham")}'
Out[2]: 'r u a hacker or wat? None None'
In [3]: foo
Out[3]: {'a': 1}
In [4]: b
Out[4]: 'ham'
@lig
lig / log.sh
Last active April 19, 2017 05:20
stdouterr
$ python3 stdouterr.py
stdout
stderr
$ python3 stdouterr.py 2>&1 >/dev/null
stderr
$ python3 stdouterr.py &>/dev/null
$ python3 stdouterr.py >/dev/null 2>&1
$ python3 stdouterr.py >/dev/null
stderr
@lig
lig / index.html
Created May 20, 2016 14:38
IT talk - DataArt - Voronezh - Trip Planner
<!doctype html>
<html lang="en" ng-app="plannerApp">
<head>
<title>IT talk - DataArt - Voronezh - Trip Planner</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://rawgit.com/kuhnza/angular-google-places-autocomplete/master/dist/autocomplete.min.css">
Python 3.4.2 (default, Jul 9 2015, 17:24:30)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class A:
... def __init__(self):
... self.__foo = 'bar'
...
>>> class B(A):
... def foo(self):
... print(self._A__foo)
@lig
lig / gitconfig
Last active August 29, 2015 14:27
[core]
editor = joe
[color]
ui = auto
[push]
default = simple
[pull]
rebase = true
[rerere]
enabled = true