Skip to content

Instantly share code, notes, and snippets.

View shivansh's full-sized avatar
🛶
Exploring.

Shivansh Rai shivansh

🛶
Exploring.
View GitHub Profile
@shivansh
shivansh / assert.diff
Last active August 13, 2016 16:02
Verbose description of problems encountered during GSOC '16
diff --git a/gtests/net/packetdrill/code.c b/gtests/net/packetdrill/code.c
index e04a9ec..075012f 100644
--- a/gtests/net/packetdrill/code.c
+++ b/gtests/net/packetdrill/code.c
@@ -197,6 +197,10 @@ static void write_tcp_info(struct code_state *code,
emit_var(code, "tcpi_snd_ssthresh", info->tcpi_snd_ssthresh);
emit_var(code, "tcpi_snd_cwnd", info->tcpi_snd_cwnd);
emit_var(code, "tcpi_rcv_space", info->tcpi_rcv_space);
+ emit_var(code, "tcpi_sacked", info->__tcpi_sacked);
+ emit_var(code, "tcpi_unacked", info->__tcpi_unacked);
sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
47: if (TCPS_HAVERCVDFIN(ssk->state) == 0)
444: TCPS_HAVERCVDFIN(ssk->state)) {
sys/netinet/tcp_fsm.h
76:#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
sys/netinet/tcp_stacks/fastpath.c
1050: (TCPS_HAVERCVDFIN(tp->t_state) == 0)) {
1450: TCPS_HAVERCVDFIN(tp->t_state) == 0) {
@shivansh
shivansh / recovery.zsh
Created December 2, 2016 07:20
zsh plugin for recovering lost commit message when `git commit` exits unsuccessfully
git() {
setopt localtraps;
trap "(){}" SIGHUP SIGINT SIGTERM
commit=
function clean_up() {
unset commit; # declare it local first
rm -f .git/COMMIT_EDITMSG_BAK
}
#!/bin/bash
set -euo pipefail
# Here strings are noted to be faster for a small amount of
# data as compared to pipes where the setup cost dominates.
# https://unix.stackexchange.com/a/219806/158139
response=$(w3m -dump "http://explainshell.com/explain?cmd="$(echo $@ | tr ' ' '+'}))
cat -s <(grep -v -e explainshell -e • -e □ -e "source manpages" <<< "$response")
@shivansh
shivansh / error-recovery-demo.log
Created May 9, 2018 19:54
This gist contains the debug output generated via `go test -v` which demonstrates the behavior of error recovery mode implemented in gocc.
=== RUN TestFail
input: a ; b
stack:
0: 0 , nil
S0 id(2,a) shift:3
stack:
0: 0 , nil
1: 3 , a
@shivansh
shivansh / clang-format
Created May 29, 2018 23:30
clang-format based on FreeBSD's style(9)
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0
AlignTrailingComments: true
SpacesBeforeTrailingComments: 2
@shivansh
shivansh / actiontable.go
Last active June 10, 2019 16:49
Demo for buggy handling of comments in gocc
// Code generated by gocc; DO NOT EDIT.
package parser
type (
actionTable [numStates]actionRow
actionRow struct {
canRecover bool
actions [numSymbols]action
}
@shivansh
shivansh / uaa-cf-application.yml
Last active July 30, 2019 05:47
CF manifest for deploying UAA
# Deploy UAA Server as Cloud Foundry Service
#
# Instructions:
# cf push -f build/sample-manifests/uaa-cf-application.yml --vars-file build/sample-manifests/vars.yml
#
---
applications:
- name: uaa-server
memory: 1024M
instances: 1