Skip to content

Instantly share code, notes, and snippets.

View ryan-blunden's full-sized avatar

Ryan Blunden ryan-blunden

  • Brisbane, Australia
View GitHub Profile
@ryan-blunden
ryan-blunden / commands.sh
Last active March 27, 2019 22:58
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/hot-reload.sh`
# usage (requires fsevents-tools): `while true; do notifywait ~/Projects/docsite; ./update.sh; 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
/**
* 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
ryan-blunden / docker-compose.yml
Last active February 25, 2019 21:40
Docker Compose example for Sourcegraph with the Go language server
version: "3"
services:
sourcegraph:
image: sourcegraph/server:3.1.1
environment:
- SRC_LOG_LEVEL=dbug
ports:
- 80:7080
- 443:7080
- 2633:2633
@ryan-blunden
ryan-blunden / postgres-upgrade.sh
Created February 7, 2019 23:17
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 \
// 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 (
"context"
"fmt"
"log"
@ryan-blunden
ryan-blunden / textdoc.json
Created December 18, 2018 22:41
Sourcegraph TextDocument
// A page can have multiple editors that each have their own document, e.g. a PR.
{
"uri": "git://github.com/django/django?d6eaf7c0183cd04b78f2a55e1d60bb7e59598310#django/__init__.py",
"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) )
[
{
"region": "us-gov-west-1",
"amis": [
{
"id": "ami-7e7aea1f",
"type": "amzn2-ami-hvm-2.0.20180622.1-x86_64-ebs"
},
{
"id": "ami-3b48d85a",
@ryan-blunden
ryan-blunden / kubernetes-dashboard-dev.sh
Last active August 12, 2018 14:20
Simple Kubernetes dashboard management for local development
#!/usr/bin/env bash
K8S_DASHBOARD_PORT=30000
k8s-dashboard-up () {
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
until kubectl get pods --namespace=kube-system | grep kubernetes-dashboard &> /dev/null
do
sleep 1