Skip to content

Instantly share code, notes, and snippets.

View jonmorehouse's full-sized avatar
💻
founder at nuon.co

Jon Morehouse jonmorehouse

💻
founder at nuon.co
View GitHub Profile
import logging
def info(msg, **kwargs):
_log(msg, logging.info, kwargs)
def warning(msg, **kwargs):
_log(msg, logging.warning, kwargs)
import subprocess
import sys
import select
cmd = 'git clone --progress https://github.com/jonmorehouse/dotfiles foobar'
p = subprocess.Popen(cmd.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
reads = [p.stdout.fileno(), p.stderr.fileno()]
func (b *bigqueryGithubDataSink) executeQuery(queryStr string, cb func([]bigquery.Value, error) error) (context.CancelFunc, error) {
if !b.isInitialized() {
return nil, ErrDataSinkNotInitialized
}
transactionContext, cancelFunc := context.WithTimeout(b.clientContext, b.opts.ReadTransactionTimeout)
query := b.client.Query(queryStr)
rowIterator, err := query.Read(transactionContext)
if err != nil {
return cancelFunc, err
#include <iostream>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include "os.h"
using namespace std;
//function prototypes
CC = g++
CFLAGS = -g -Wall -Wvla -Wshadow -Wunreachable-code -Wconversion -Wno-sign-conversion -Wno-sign-compare -Wno-write-strings -fdiagnostics-color=always
all:
$(CC) $(CFLAGS) filesys.cpp mlist.cpp os.cpp -o filesys
clean:
rm -f *.o filesys
@jonmorehouse
jonmorehouse / doctor-example.json
Created September 24, 2019 20:56
doctor-example from better doctor api
{
"meta": {
"data_type": "Doctor",
"total": 1,
"count": 1
},
"data": {
"practices": [
{
"location_slug": "ca-san-bernardino",
uri = '/httpbin/headers'
# we want to strip the `/httpbin` off the front
new_uri = uri.lstrip('/httpbin')
# this returns 'eaders' because it treats the input into lstrip as a set of characters to strip. So it strips all of
# those characters until it finds something that is not in one of those (e)
# now, let's try with something more predictable
uri = '/httpbin/status'
# this returns status, as expected!
~programs/kara-patient-derived-views-ui (master*)$ ds view debug --prefix=cli-events debug_op=resource-state
starting datastore-cli...
viewing 3afa28c7-cefc-4198-851c-8b861c0c4529
created 3 minutes ago
{
"component-idx": 0,
"created_at": 1609891937,
"debug_id": "c098e50b-a5b3-49b8-b3f9-4dbf224021c2",
"debug_op": "resource-state",
"debug_state": {
package cmd
import (
"context"
"fmt"
"log"
"github.com/hashicorp/waypoint/pkg/server/gen"
"github.com/powertoolsdev/go-common/config"
"github.com/powertoolsdev/go-common/shortid"
project = "abc"
app "mario" {
build {
use "docker-pull" {
image = "pengbai/docker-supermario"
tag = "latest"
disable_entrypoint = true
}
}