As configured in my dotfiles.
start new:
tmux
start new with session name:
| try: | |
| from functools import update_wrapper, wraps | |
| except ImportError: | |
| from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback. | |
| from django.http import HttpResponseForbidden | |
| from django.utils.decorators import available_attrs | |
| def user_passes_test(test_func): | |
| def decorator(view_func): |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # vim: ai ts=4 sts=4 et sw=4 | |
| """ | |
| Tools to extract feed links, test if they are valid and parse them | |
| with feedparser, returning content or a proper error. | |
| """ |
| # -*- coding: utf-8 -*- | |
| from django import forms | |
| from crispy_forms.helper import FormHelper | |
| from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field | |
| from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions | |
| class MessageForm(forms.Form): | |
| text_input = forms.CharField() |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| # Small extension to create a clone of the element without | |
| # metamorph binding tags and ember metadata | |
| $.fn.extend | |
| safeClone: -> | |
| clone = $(@).clone() | |
| # remove content bindings | |
| clone.find('script[id^=metamorph]').remove() | |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| # /etc/network/interfaces | |
| # | |
| auto lo | |
| iface lo inet loopback | |
| # device: eth0 | |
| iface eth0 inet manual | |
| # IPv4 bridge | |
| # (connect ONLY your firewall/router KVM instance here, this is the WAN device!) |
| // Helps with this problem: | |
| // http://stackoverflow.com/questions/8059914/express-js-hbs-module-register-partials-from-hbs-file | |
| var hbs = require('hbs'); | |
| var fs = require('fs'); | |
| var partialsDir = __dirname + '/../views/partials'; | |
| var filenames = fs.readdirSync(partialsDir); |
See http://stackoverflow.com/a/14381327/130638 for explanation.
| #!/usr/bin/env python | |
| from scapy.all import * | |
| ap_list = [] | |
| def PacketHandler(pkt) : | |
| if pkt.haslayer(Dot11) : | |
| if pkt.type == 0 and pkt.subtype == 8 : |