Skip to content

Instantly share code, notes, and snippets.

View pcj's full-sized avatar

Paul Cody Johnston pcj

View GitHub Profile
To set up the Go repo
git clone https://go.googlesource.com/go
cd go
git checkout dev.typeparams
cd src
./make.bash
Use that directory with go_local_sdk in WORKSPACE.
import * as vscode from 'vscode';
export async function quickPickItem(items: string[]): Promise<string[]> {
const options = items.map(item => ({ label: item }));
return new Promise((resolve, _) => {
const quickPick = vscode.window.createQuickPick();
const placeholder = "Select a item.";
quickPick.placeholder = placeholder;
#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@gaffer-93
gaffer-93 / helloworld_keepalive_deadlines.py
Last active November 6, 2018 20:53
gRPC's helloworld example modified to demonstrate deadlines and keepalive TCP_USER_TIMEOUT introduced in 1.16
import grpc
import time
import helloworld_pb2
import helloworld_pb2_grpc
def run():
channel_opts = [
(
# Interval at which grpc will send keepalive pings
'grpc.keepalive_time_ms',
#!/usr/bin/env python3
"""Script for analyzing raw data `bazel analyze-profile --dump=raw`
Usage:
First obtain the raw profile data of your build.
$ bazel build --profile=my_profile.dat //some:target
$ bazel analyze-profile my_profile.dat --dump=raw > my_profile.raw
@campoy
campoy / styles.css
Created April 6, 2018 21:32
Dark themed Go present (cmd/present/static/styles.css)
@import url('https://fonts.googleapis.com/css?family=Montserrat');
@import url('https://fonts.googleapis.com/css?family=Inconsolata');
@media screen {
/* Framework */
html {
height: 100%;
}
load("@io_bazel_rules_go//go:def.bzl", "go_path")
load("@io_bazel_rules_go//go/private:providers.bzl", "GoLibrary", "GoPath")
_MOCKGEN_TOOL = "@com_github_golang_mock//mockgen"
def _gomock_sh_impl(ctx):
go_toolchain = ctx.toolchains["@io_bazel_rules_go//go:toolchain"]
gopath = "$(pwd)/" + ctx.var["BINDIR"] + "/" + ctx.attr.gopath_dep[GoPath].gopath

bazel query cheatsheet

which packages depend on qtdb lib?

bazel query 'rdeps(..., //vistar/geo/qtdb:go_default_library)' --output package 

which packages does qtdb depend on?

@ianoc-stripe
ianoc-stripe / bazel
Created March 14, 2017 15:00
bazel launcher
#!/bin/bash
# update this to move to later versions of this repo:
# https://github.com/bazelbuild/bazel
ORIGINAL_PWD=$PWD
TMPDIR="${TMPDIR:-/tmp}"
RND_UID=$(date "+%s")
@bobbytables
bobbytables / build.sh
Created February 18, 2017 15:49
Protocol Buffer build script for multiple folders
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}