#!/bin/bash | |
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) ) | |
rulefile="rules.tmp" | |
echo "" > $rulefile | |
sudo pfctl -a com.apple/tun -F nat | |
for i in "${interfaces[@]}" | |
do | |
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}" | |
echo $RULE >> $rulefile | |
done |
int doubler(int x) { | |
return 2 * x; | |
} |
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
# -*- mode:python; -*- | |
# | |
# Copyright 2016 The Bazel Authors. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
diff -Naur a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c | |
--- a/drivers/hid/hid-apple.c 2014-12-07 23:21:05.000000000 +0100 | |
+++ b/drivers/hid/hid-apple.c 2015-04-16 16:18:35.009726041 +0200 | |
@@ -535,6 +535,8 @@ | |
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | |
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | |
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | |
+ .driver_data = APPLE_HAS_FN }, | |
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_NEW), | |
.driver_data = APPLE_HAS_FN }, |
#!/bin/sh | |
set -e | |
function update_version { | |
semver="$1" | |
sed -i "s/^version = \".*\"\s\+#:version$/version = \"$semver\" #:version/g" Cargo.toml | |
if git ls-files Cargo.lock --error-unmatch > /dev/null 2>&1; then | |
cargo update |
#cloud-config | |
coreos: | |
etcd: | |
# generate a new token for each unique cluster from https://discovery.etcd.io/new | |
discovery: https://discovery.etcd.io/<token> | |
# multi-region deployments, multi-cloud deployments, and droplets without | |
# private networking need to use $public_ipv4 | |
addr: $private_ipv4:4001 | |
peer-addr: $private_ipv4:7001 |
$ uname -a | |
Linux laptop 3.10.0-123.13.2.el7.x86_64 #1 SMP Fri Dec 12 19:51:03 EST 2014 x86_64 x86_64 x86_64 GNU/Linux | |
$ rustc -Vv | |
rustc 1.0.0-alpha (44a287e6e 2015-01-08 17:03:40 -0800) | |
binary: rustc | |
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7 | |
commit-date: 2015-01-08 17:03:40 -0800 | |
host: x86_64-unknown-linux-gnu | |
release: 1.0.0-alpha | |
$ cat hello.rs |