Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@3demax
3demax / README
Created November 3, 2019 07:33
Django channels example
Django-Channels tutorial code + sending async message from regular view

Node Error Handling and Domains

"Occurrences in this domain are beyond the reach of exact prediction because of the variety of factors in operation, not because of any lack of order in nature." - Albert Einstein

"Master of my domain" - Larry David

Error handling in an asynchronous language works in a unique way and presents many challenges, some unexpected. This tutorial reviews the various error handling patterns available in node, and explains how domains can be used to improve it.

There are four main error handling patterns in node:

  • Error return value
@3demax
3demax / tox.js
Last active August 29, 2015 13:57
fail
/* DO NOT EDIT. Automatically generated by valabind from toxcore */
var ffi = require('ffi'), ref = require('ref'), Struct = require('ref-struct');
var lib = new ffi.DynamicLibrary('libtoxcore'+ffi.LIB_EXT);
function Tname(T) {
return T.hasOwnProperty('$name') ? T.$name : T.name;
}
#!/usr/bin/env bash
# gsettings list-recursively org.gnome.system.proxy
# Change de ip address and port number accordingly.
function myProxyOn() {
gsettings set org.gnome.system.proxy mode 'manual' # ' manual / nome / automatic '
gsettings set org.gnome.system.proxy.http host '10.0.0.1'
gsettings set org.gnome.system.proxy.http port 8080
gsettings set org.gnome.system.proxy.https host '10.0.0.1'
@3demax
3demax / recorder.py
Last active September 5, 2022 21:53
Simple sound recorder for opus codec
import ipdb
import pyaudio
from time import sleep
import opus
from opus import decoder as opus_decoder
from opus import encoder as opus_encoder
DEBUG = True
@3demax
3demax / skype-notifications.py
Created March 20, 2012 13:54
Skype native notifications
#!/usr/bin/env python2
# Python script to make Skype use notify-osd
# Copyright (c) 2009, Lightbreeze
# 2010 Corbin Simpson <MostAwesomeDude@gmail.com>
# Modification for notification-daemon compatibility
#
# This program is free software: you can redistribute it and/or modify
@3demax
3demax / .nanorc
Created February 20, 2012 06:39
/usr/share/nano/pkgbuild.nanorc
#this is part of ~/.nanorc file
## Arch PKGBUILDS
include "/usr/share/nano/pkgbuild.nanorc"
# yaourt sysuplist
include "/usr/share/nano/sysuplist.nanorc"
@3demax
3demax / nm-signal-0.svg
Created January 16, 2012 16:18
rc.lua for lualock simpleblack theme
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@3demax
3demax / tabbar-tweak.el
Created October 5, 2011 14:58
Emacs tabbar-mode visual tweaks
;; This are setting for nice tabbar items
;; to have an idea of what it looks like http://imgur.com/b0SNN
;; inspired by Amit Patel screenshot http://www.emacswiki.org/pics/static/NyanModeWithCustomBackground.png
;; Tabbar
(require 'tabbar)
;; Tabbar settings
(set-face-attribute
'tabbar-default nil
:background "gray20"