Skip to content

Instantly share code, notes, and snippets.

Ryan Blunden ryan-blunden

View GitHub Profile
ryan-blunden /
Last active Apr 12, 2019
WIP Python script for generating the nav for Once fully baked, it will be ported to Go and greatly improved.
#!/usr/bin/env python3
from dataclasses import dataclass, field
import inspect
import os
import re
import sys
from typing import List
def log(message):
ryan-blunden /
Last active Mar 27, 2019
Sourcegraph with language servers behind SSL with basic auth
# Execute settings to insert lang server settings
docker container exec sourcegraph /bin/bash -c 'cat /var/opt/sourcegraph/settings_init.sql | psql -U postgres sourcegraph'
# Execute psql commands
docker container exec sourcegraph /bin/bash -c 'echo "SELECT * FROM settings;" | psql -U postgres sourcegraph'
#!/usr/bin/env bash
# usage (requires fswatch): `fswatch -o . | xargs -n1 -I{} ./bin/`
# usage (requires fsevents-tools): `while true; do notifywait ~/Projects/docsite; ./; done`
killall docsite
cd cmd/docsite
go get
cd -
docsite -config "../sourcegraph/doc/docsite.json" serve
#! /usr/bin/env bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ~/.sourcegraph/config/sourcegraph.key -out ~/.sourcegraph/config/sourcegraph.crt -subj "/CN=localhost
View mermaid.css
* Placeholder for required styles to correctly render exported Mermaid SVG files from the online live editor
/* Number in below styles is unique for each export */
#mermaid-1551921004212 .label {
font-family: 'trebuchet ms', verdana, arial;
color: #333;
font-size: 14px;
ryan-blunden / docker-compose.yml
Last active Feb 25, 2019
Docker Compose example for Sourcegraph with the Go language server
View docker-compose.yml
version: "3"
image: sourcegraph/server:3.1.1
- 80:7080
- 443:7080
- 2633:2633
ryan-blunden /
Created Feb 7, 2019
Testing Sourcegraph 3.0 db upgrade
#!/usr/bin/env bash
set -xeuo pipefail
export OLD=${OLD:-"9.6"}
export NEW=${NEW:-"11"}
export SRC_DIR=${SRC_DIR:-"$HOME/.sourcegraph"}
docker run \
-w /tmp/upgrade \
View contributors.go
// Version that excludes Sourcegraphers and prints a markdown list with hyperlinks.
// Commented out code was experimenting with printing contributors for each relevant repository but as some repositories don't have issues, it wasn't used.
package main
import (
ryan-blunden / textdoc.json
Created Dec 18, 2018
Sourcegraph TextDocument
View textdoc.json
// A page can have multiple editors that each have their own document, e.g. a PR.
"uri": "git://",
"languageId": "python",
"text": "from django.utils.version import get_versionVERSION = (2, 0, 0, 'alpha', 0)__version__ = get_version(VERSION)def setup(set_prefix=True): \"\"\" Configure the settings (this happens as a side effect of accessing the first setting), configure logging and populate the app registry. Set the thread-local urlresolvers script prefix if `set_prefix` is True. \"\"\" from django.apps import apps from django.conf import settings from django.urls import set_script_prefix from django.utils.encoding import force_text from django.utils.log import configure_logging configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) if set_prefix: set_script_prefix( '/' if settings.FORCE_SCRIPT_NAME is None else force_text(settings.FORCE_SCRIPT_NAME) )
View linux2-amis.json
"region": "us-gov-west-1",
"amis": [
"id": "ami-7e7aea1f",
"type": "amzn2-ami-hvm-2.0.20180622.1-x86_64-ebs"
"id": "ami-3b48d85a",
You can’t perform that action at this time.