Skip to content

Instantly share code, notes, and snippets.

View terlar's full-sized avatar

Terje Larsen terlar

View GitHub Profile
@terlar
terlar / kubectl.fish
Last active May 18, 2026 16:01
Kubernetes fish completions
# kubernetes - is an open source system for managing containerized
# applications across multiple hosts, providing basic mechanisms for
# deployment, maintenance, and scaling of applications.
# See: https://kubernetes.io
function __kubectl_no_command
set -l cmd (commandline -poc)
if not set -q cmd[2]
return 0
end
@terlar
terlar / diagram.d2
Last active June 12, 2024 19:54
Diagrams, example
internet: "Public Internet"
google: "Google Cloud" {
ext-lb: "HTTP(S) Load Balancer"
cloud-armor: "Cloud Armor"
ext-vpc: "shared-external-vpc" {
waf: WAF
}
{ lib }:
{
filterDivergedAttrsRecursive =
lhs: rhs:
let
pred = path: v: (!lib.hasAttrByPath path rhs || (lib.getAttrFromPath path rhs) != v);
recurse =
path: set:
lib.listToAttrs (
@terlar
terlar / README.markdown
Last active October 11, 2019 16:07
ArchLinux on Mac Book Retina 13"
@terlar
terlar / fish_prompt.fish
Created October 5, 2012 00:45
Prompt for fish with git statuses
set -U fish_color_user magenta
set -U fish_color_host yellow
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
# User
set_color $fish_color_user
printf (whoami)
set_color normal
@terlar
terlar / bitbucket-to-github.sh
Created May 18, 2017 07:55
Migrate bitbucket repo to github
#!/bin/bash
set -xeuo pipefail
main() {
local usr="${1?user must be provided}"
local bb_repo="${2?bitbucket repo must be provided}"
local target="${bb_repo##*/}"
git clone --mirror "${bb_repo}" "${target}"
cd "${target}" || exit

Run controller action

Example 1:

c = IndexController.new
c.params = { utf8: '✓', test: 'param' }
c.action
@terlar
terlar / Rakefile
Created October 10, 2013 14:25
Rakefile for test running
require 'rake/testtask'
require 'bundler/gem_tasks'
namespace 'test' do
test_files = FileList['spec/**/*_spec.rb']
integration_test_files = FileList['spec/**/*_integration_spec.rb']
unit_test_files = test_files - integration_test_files
desc 'Run unit tests'
Rake::TestTask.new('unit') do |t|
@terlar
terlar / PKGBUILD
Created August 10, 2013 21:02
irssi-script-advanced-windowlist
# Maintainer: Tom Vincent <http://tlvince.com/contact/>
pkgname=irssi-script-advanced-windowlist
_name=adv_windowlist.pl
pkgver=0.7c
pkgrel=2
pkgdesc="Adds a permanent advanced window list to irssi status bar"
arch=(any)
url="http://anti.teamidiot.de/static/nei/*/Code/Irssi/"
source="http://anti.teamidiot.de/static/nei/*/Code/Irssi/$_name"
license=('GPL')
@terlar
terlar / cx.mopidy.plist
Created August 2, 2013 07:38
Mopidy as OSX service
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>cx.mopidy</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/mopidy</string>
</array>