Skip to content

Instantly share code, notes, and snippets.

require "try-catch"
try {
function()
error('oops')
end,
catch {
function(error)
print('caught error: ' .. error)
@alex-eri
alex-eri / vkmixin.py
Last active August 29, 2015 14:25 — forked from adilkhash/vkmixin.py
#!/usr/bin/env python
#
# Vkontatke OAuth 2.0 wrapper
# Copyright 2011, Adil Khashtamov [adil.khashtamov@gmail.com]
# http://khashtamov.kz
#
#
import logging
try:
code
except RuntimeError as e:
print(e)
except DatabaseError as e:
reconnect()
print(e)
except Exception as e:
print(e)
exit(-1)
$ python3 zte.py
DEBUG:asyncio:Using selector: EpollSelector
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/aiohttp/client.py", line 191, in _request
yield from resp.start(conn, read_until_eof)
File "/usr/lib/python3.5/site-packages/aiohttp/client_reqrep.py", line 617, in start
message = yield from httpstream.read()
File "/usr/lib/python3.5/site-packages/aiohttp/streams.py", line 592, in read
result = yield from super().read()
File "/usr/lib/python3.5/site-packages/aiohttp/streams.py", line 447, in read
@alex-eri
alex-eri / wkhtmltopdf-debian.patch
Created May 30, 2017 10:13
wkhtmltopdf debian for dpkg-buildpackage
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..8737890
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,11 @@
+Wkhtmltopdf without X server
+----------------------------
+
+Due to its dependency on Qt-WebKit, wkhtmltopdf requires an X11 server to
@alex-eri
alex-eri / tun-ping-win.py
Created July 14, 2018 16:43 — forked from glacjay/tun-ping-win.py
Reading/Writing OpenVPN's TUN/TAP Device under Windows using Python.
import _winreg as reg
import win32file
adapter_key = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}'
def get_device_guid():
with reg.OpenKey(reg.HKEY_LOCAL_MACHINE, adapter_key) as adapters:
try:
postgres=# create function lala () returns numeric LANGUAGE plpgsql as $$ begin return 1; end;$$;
CREATE FUNCTION
postgres=# select lala();
lala
------
1
(1 row)
postgres=# select "lala"();
lala
ls kernel-module*
kernel-module-6lowpan-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-8021q-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-8139cp-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-8139too-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-act-mirred-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-af-key-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-ah4-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-alx-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
kernel-module-anubis-4.14.67-yocto-standard_4.14.67+git0+3435617380_084af9624d-r0_genericx86_64.ipk
from PyQt5.QtDBus import QDBusAbstractInterface, QDBusConnection
class Properties(QDBusAbstractInterface):
def __init__(self, parent=None):
super().__init__(parent.service(), parent.path(),
'org.freedesktop.DBus.Properties', parent.connection(), parent)
def __getitem__(self, name):
r = self.call('Get', self.parent().interface(), name)
if r: