Skip to content

Instantly share code, notes, and snippets.

View benesch's full-sized avatar

Nikhil Benesch benesch

View GitHub Profile
@benesch
benesch / vpndiagnose.sh
Created December 24, 2014 21:29
OS X VPN Diagnostics
#!/usr/bin/env bash
scutil --nc list
IFS=$'\n' interfaces=($(scutil --nc list | tail -n+2 | sed -E 's/.*"([^"]+)".*/\1/'))
for interface in "${interfaces[@]}"
do
scutil --nc show "$interface"
echo "Search domains"
#!/usr/bin/env python
from __future__ import print_function
import requests
# This session ID can be obtained by signing into the Q from your
# browser and inspecting the value of the JSESSIONID cookie. It expires
# frequently!
SESSION_ID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
diff --git a/kern/fs/sfs/sfs_jphys.c b/kern/fs/sfs/sfs_jphys.c
index 1fe9cac..898cdc2 100644
--- a/kern/fs/sfs/sfs_jphys.c
+++ b/kern/fs/sfs/sfs_jphys.c
@@ -1912,7 +1912,7 @@ sfs_jphys_startwriting(struct sfs_fs *sfs)
jp->jp_writermode = true;
/* start checkpoint daemon */
- /* TODO: start_checkpoint_daemon(sfs); */
+ start_checkpoint_daemon(sfs);
void SetPreemptionFrequency(int hz);
int GetAllTCBs(tcb_t *tcb_array_out);
int GetTCBStats(tcb_stat_t *tcb_array_out);
int UntypedRetype(mem, RunQueueCapability);
int SetRootRunqueue(CPtr runqueue);
int Untyped_Retype(untyped_t mem, int type, ...);
struct tcb_stat {
unsigned execution_nanoseconds;
unsigned preemptions;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benesch
benesch / cpython-2.7.3-systemtap.patch
Last active August 7, 2016 09:55
Python 2.7.3 SystemTap patch
diff -up Python-2.7rc1/configure.in.systemtap Python-2.7rc1/configure.in
--- Python-2.7rc1/configure.in.systemtap 2010-06-06 10:53:15.514975012 -0400
+++ Python-2.7rc1/configure.in 2010-06-06 10:53:15.520974361 -0400
@@ -2616,6 +2616,38 @@ if test "$with_valgrind" != no; then
)
fi
+# Check for dtrace support
+AC_MSG_CHECKING(for --with-dtrace)
+AC_ARG_WITH(dtrace,
@benesch
benesch / pre-push
Created March 9, 2017 20:28
cockroach pre-push hook to run `make check`
#!/usr/bin/env bash
[[ "$(git config --bool hooks.checkBeforePush)" = true ]] || exit 0
# Redirect output to stderr.
exec >&2
z40=0000000000000000000000000000000000000000
checked_trees="$(git rev-parse --git-dir)/checked_trees" || {
echo "unable to determine git directory; aborting push"
@benesch
benesch / ls.after
Created March 23, 2017 17:28
cockroach archive diff
lrwxr-xr-x 1 benesch staff 34 Mar 20 11:13 ./cockroach-3ae03f3ed/src/github.com/cockroachdb/cockroach/pkg/storage/engine/data.pb.cc -> ./cockroach/pkg/roachpb/data.pb.cc
lrwxr-xr-x 1 benesch staff 38 Mar 20 11:13 ./cockroach-3ae03f3ed/src/github.com/cockroachdb/cockroach/pkg/storage/engine/internal.pb.cc -> ./cockroach/pkg/roachpb/internal.pb.cc
lrwxr-xr-x 1 benesch staff 38 Mar 20 11:13 ./cockroach-3ae03f3ed/src/github.com/cockroachdb/cockroach/pkg/storage/engine/metadata.pb.cc -> ./cockroach/pkg/roachpb/metadata.pb.cc
lrwxr-xr-x 1 benesch staff 50 Mar 20 11:13 ./cockroach-3ae03f3ed/src/github.com/cockroachdb/cockroach/pkg/storage/engine/mvcc.pb.cc -> ./cockroach/pkg/storage/engine/enginepb/mvcc.pb.cc
lrwxr-xr-x 1 benesch staff 53 Mar 20 11:13 ./cockroach-3ae03f3ed/src/github.com/cockroachdb/cockroach/pkg/storage/engine/rocksdb.pb.cc -> ./cockroach/pkg/storage/engine/enginepb/rocksdb.pb.cc
lrwxr-xr-x 1 benesch staff 40 Mar 20 11:13 ./cockroach-3ae03f3ed/src/github.com/cockroachdb/cockroach/
panic: indexed var linked to different container (*sql.renderNode) &{planner:0xc4208e41a0 source:{info:0xc420962a00 plan:0xc420962a80} sourceInfo:[0xc420962a00] ivarHelper:{vars:[{Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:17 container:0xc42008c120} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>} {Idx:0 container:<nil>}] container:0xc42008c120} render:[] columns:[] isStar:false numOriginalCols:0 ordering:{exactMatchCols:map[] ordering:[] unique:false} explain:0 curSourceRow:[] row:[] noCopy:{}}, expected (<nil>) <nil> [recovered]
panic: select unnest(c
package main
import (
"database/sql"
_ "github.com/lib/pq"
)
func main() {
db, err := sql.Open("postgres", "postgres://root@localhost:26257/goose?sslmode=disable")
if err != nil {