Skip to content

Instantly share code, notes, and snippets.

View stephenwithav's full-sized avatar

Steven Edwards stephenwithav

View GitHub Profile
@stephenwithav
stephenwithav / gcloud-tramp.el
Created June 6, 2023 00:38 — forked from jackrusher/gcloud-tramp.el
Tramping into GCloud instances from within emacs
;; make sure you've set your default project with:
;; gcloud config set project <project-name>
(require 'tramp)
(add-to-list 'tramp-methods
'("gcssh"
(tramp-login-program "gcloud compute ssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
@stephenwithav
stephenwithav / setup-gitlab-for-magit-in-doom-emacs.md
Created May 20, 2023 18:52 — forked from Azeirah/setup-gitlab-for-magit-in-doom-emacs.md
Setting up magit forge for gitlab in Doom Emacs

Magit forge for Gitlab in Doom Emacs

This guide assumes you're working on a Unix-like environment. I'm using Linux Mint (Ubuntu). It should work on Macs, and might on Windows.

These are the four steps you can use as a checklist, see the headings below for the details on each step.

  • Enable forge support
  • Create a Gitlab API key
  • Add your gitlab credentials to ~/.authinfo.gpg
  • Set-up forge in emacs
@stephenwithav
stephenwithav / sdl_render-text-with-direction.cpp
Created January 2, 2022 19:51 — forked from wutipong/sdl_render-text-with-direction.cpp
SDL Render text with Freetype and harfbuzz, using outline render.
#include <iostream>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_OUTLINE_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_main.h>
#include <string>
@stephenwithav
stephenwithav / custom-elfeed.el
Created November 4, 2021 23:38
My custom-elfeed settings.
(provide 'custom-elfeed)
(fset 'rand/feed/open-in-background
(kmacro-lambda-form [?y ?\C-u ?\C-\[ ?x ?e ?w ?w ?\C-m ?\C-y ?\C-m ?\C-x ?b ?\C-m] 0 "%d"))
(define-key elfeed-search-mode-map (kbd "v") 'rand/feed/open-in-background)
(run-with-timer 300 300 'elfeed-update)
@stephenwithav
stephenwithav / .Xmodmap
Last active February 9, 2024 15:35
mousekeys
keysym F7 = MouseKeys_Enable
keysym Caps_Lock = MouseKeys_Enable
@stephenwithav
stephenwithav / README.md
Created February 27, 2020 22:31
AVL/Red-Black tree benchmarks for Go. The first set uses interface{} types for key/value, while the second uses an automatically generated tree with an int for key and a string for value.

Go generics remain in a galaxy far, far away.

That doesn't mean Go developers have to remain in the dark ages forever, though.

Developer tools like YASnippet allow us to reuse boilerlate code for common, repetitive tasks including priority queues and AVL Trees without the performance hit imposed by .(casting) interface{}s specific to our preferred types.

If you need or want an algorithm or a common pattern converted into a Go snippet, create an issue here and I'll get it done. (I'm currently converting some of the algorithms in this repo into snippets.)

@stephenwithav
stephenwithav / build.sh
Last active February 22, 2020 14:37
Create a markdown file with links to every public interface defined in the Go 1.x stdlib.
git clone https://github.com/golang/go
cd go/src
wget https://gist.github.com/stephenwithav/a688d06c2d937ff8748d73226848601c/raw/e7d9a16084ccfd4bf10f854c81cf21e51d655d5d/build.sh
grep -r 'type [A-Z][[:alnum:]]* interface {' | grep -v _test | grep \.go | grep -v golden | grep -v vendor | cut -d '{' -f 1 | sed 's/[[:alnum:]._]*:/:/' | sort | sed 's/\([^:]*\):\s*type \([[:alnum:]]*\) interface/\1[\2](https:\/\/pkg.go.dev\/\1#\2)\n/' > ~/gointerfaces.md
cd ../..
rm -rf go
@stephenwithav
stephenwithav / tsort
Created February 19, 2020 23:50
sort.Interface
# name: Sort interface template
# key: tsort
# --
type $1 []$2
func ($3 $1) Len() int { return len($3) }
func ($3 $1) Less(i, j int) bool { return $3[i] < $3[j] }
func ($3 $1) Swap(i, j int) { $3[i], $3[j] = $3[j], $3[i] }
@stephenwithav
stephenwithav / Doxyfile
Last active June 16, 2019 09:55
Doxyfile for building docs+images for Chromium 77.0.3827.1
# Doxyfile 1.8.13
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Chromium"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =