Skip to content

Instantly share code, notes, and snippets.

@delicb
delicb / error
Created Oct 6, 2021
flask error handling - mypy error
View error
xxx/__init__.py: note: In function "register_error_handlers":
xxx/__init__.py:115: error: Argument 1 has incompatible type
"Callable[[Exception], Union[Union[Response, Any, Dict[str, Any], Generator[Any, None, None]], Tuple[Union[Response, Any, Dict[str, Any], Generator[Any, None, None]], Union[Headers, Dict[str, Union[str, List[str], Tuple[str, ...]]], List[Tuple[str, Union[str, List[str], Tuple[str, ...]]]]]], Tuple[Union[Response, Any, Dict[str, Any], Generator[Any, None, None]], int], Tuple[Union[Response, Any, Dict[str, Any], Generator[Any, None, None]], int, Union[Headers, Dict[str, Union[str, List[str], Tuple[str, ...]]], List[Tuple[str, Union[str, List[str], Tuple[str, ...]]]]]], Callable[[Dict[str, Any], StartResponse], Iterable[bytes]]]]";
expected "ErrorHandlerCallable[Exception]" [arg-type]
@app.errorhandler(Exception)
^
Found 1 error in 1 file (checked 8 source files)
@delicb
delicb / README.md
Last active Mar 29, 2021
Getting OSO to work with Go on Apple M1 chip
View README.md

Preparing OSO for ARM64

This is meant as a workaround for people using Apple M1 based computers and want to use OSO.

OSO provides Go package, but it depends on a core library, which is written in Rust in with which OSO communicates via C bindings.

First thing, clone OSO repository:

git clone https://github.com/osohq/oso.git
View keybase.md

Keybase proof

I hereby claim:

  • I am delicb on github.
  • I am delboy (https://keybase.io/delboy) on keybase.
  • I have a public key ASDyAu5BmzJ9UxZeeAwp4rqXjy4o_E2l2OLAlNSMpTD8Hwo

To claim this, I am signing this object:

View genesis_public_key
040cc5ed31fee1cc1d1a4219e9b43f0fce85a7f2f2cf78932f1b10aa80677c75ba9b914f16f983e2f97460da44202949ca061cdababc9234ebb251166fa25740ca;icvitkovac
@delicb
delicb / compiled_file_python_version.py
Created May 30, 2016 — forked from delimitry/compiled_file_python_version.py
Get the version of Python by which the file was compiled
View compiled_file_python_version.py
#!/usr/bin/evn python
# -*- coding: utf8 -*-
import os
import struct
magics = {
20121: 'Python 1.5.x',
50428: 'Python 1.6',
50823: 'Python 2.0.x',
View gist:00e64f43e3bc501a20a4
### Keybase proof
I hereby claim:
* I am delicb on github.
* I am delboy (https://keybase.io/delboy) on keybase.
* I have a public key whose fingerprint is 4374 1553 56F0 74DD A234 328A 60FF 8E76 F728 19FA
To claim this, I am signing this object:
@delicb
delicb / ipy_clr_test.py
Created Jul 25, 2014
IronPython CLR __clrtype__ manipultaion example
View ipy_clr_test.py
# from http://devhawk.net/2009/04/21/__clrtype__-metaclasses-ironpython-classes-under-the-hood/
import clr
clr.AddReference('Microsoft.Scripting.dll')
clr.AddReference('Microsoft.Dynamic.dll')
clr.AddReference('IronPython.dll')
from Microsoft.Scripting.Generation import Snippets
from System.Reflection.Emit import OpCodes
from System.Reflection import FieldAttributes
@delicb
delicb / autohotkey.ahk
Last active Nov 22, 2018
My autohotkey scripts. I have it placed in
View autohotkey.ahk
;===============================================================
; Perform action on computer unlock.
;===============================================================
;---------------------------------------------------------------
;Notify Lock\Unlock
; This script monitors LockWorkstation calls
;
; If a change is detected it 'notifies' the calling script
; On Lock
; This script will call function "on_lock()"
@delicb
delicb / table_size.sql
Last active Dec 20, 2015
Lists tables and its sizes in postgresql
View table_size.sql
SELECT
table_schema || '.' || table_name AS table_full_name,
pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')) AS size
FROM information_schema.tables
WHERE table_schema = 'public'
ORDER BY
pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') DESC
@delicb
delicb / pyvenvex.py
Created Jun 26, 2013 — forked from vsajip/pyvenvex.py
Creates python 3.3 virtual environment and can install distribute and pip in it.
View pyvenvex.py
#
# Copyright (C) 2013 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve