Skip to content

Instantly share code, notes, and snippets.

View ORBAT's full-sized avatar

Tom Eklöf ORBAT

  • Helsinki, Finland
View GitHub Profile
@ORBAT
ORBAT / ramdisk.sh
Last active December 11, 2017 09:56 — forked from rxin/ramdisk.sh
ramdisk create/delete/list on macOS
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
E_BADARGS=99
baseName=$(basename $0)
function printHelp() {
>&2 echo -e "\nUsage: "

Keybase proof

I hereby claim:

  • I am orbat on github.
  • I am orbat (https://keybase.io/orbat) on keybase.
  • I have a public key ASAvyiaD4ScZER8SHILKW4NDD1WMCHVFrWanP4mGV_MhWAo

To claim this, I am signing this object:

@ORBAT
ORBAT / mix.exs
Created April 17, 2018 18:49
Mix project file with incorrect dependency
defmodule Mulix.MixProject do
use Mix.Project
def project do
[
app: :myapp,
version: "0.1.0",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps()
Started ElixirLS
Compiling with Mix env test
[Info - 9:53:23 PM] [ElixirLS Dialyzer] Analyzing 0 modules: []
[Info - 9:53:23 PM] [ElixirLS Dialyzer] Analysis finished in 40 milliseconds
[Info - 9:53:23 PM] [ElixirLS Dialyzer] Writing manifest...
[Info - 9:53:25 PM] [ElixirLS Dialyzer] Done writing manifest.
Compiling 1 file (.ex)
@ORBAT
ORBAT / git-clone-subdir.sh
Last active February 3, 2020 13:46
Clones only one subdirectory of a git repo. Preserves history, but removes all refs that don't contain the subdirectory
#! /bin/bash
# https://stackoverflow.com/questions/39956637/running-git-filter-branch-subdirectory-filter-to-also-remove-get-rid-of-other-su
repo=${1:?"Repo in first argument"}
subdir=${2:?"subdirectory name in second argument"}
temp_dir=$(mktemp -d)
function log {
>&2 echo
>&2 echo -e "\t $@"
@ORBAT
ORBAT / all_to_hipe.ex
Created August 7, 2018 12:45
Playing around with HiPE compilation
defmodule HiPE.Loader do
@doc "Returns `module_info`s for all loaded modules, with `native: true|false`"
def all_modules(native \\ false) do
:code.all_loaded()
|> Enum.map(&elem(&1, 0))
|> Enum.map(&Kernel.apply(&1, :module_info, []))
|> Enum.map(&Enum.into(&1, %{}))
|> Enum.filter(fn %{compile: compile} ->
!match?([], compile)
end)
@ORBAT
ORBAT / message.go
Last active October 3, 2018 17:00
Message encoding example
package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"gopkg.in/vmihailenco/msgpack.v4"
"reflect"
@ORBAT
ORBAT / error.txt
Last active April 24, 2019 16:11
go-pg composite type array error (code example below error)
panic: got slice, wanted struct
goroutine 1 [running]:
github.com/go-pg/pg/orm.(*tables).get(0xc00013f890, 0x140e020, 0x131cfe0, 0xc0001a2100, 0xc0001a2148)
REDACTED/go/pkg/mod/github.com/go-pg/[email protected]+incompatible/orm/tables.go:87 +0x528
github.com/go-pg/pg/orm.(*tables).Get(0xc00013f890, 0x140e020, 0x131cfe0, 0xc000146e00)
REDACTED/go/pkg/mod/github.com/go-pg/[email protected]+incompatible/orm/tables.go:132 +0x44
github.com/go-pg/pg/orm.GetTable(0x140e020, 0x131cfe0, 0xc0001a20a0)
REDACTED/go/pkg/mod/github.com/go-pg/[email protected]+incompatible/orm/tables.go:54 +0x41
github.com/go-pg/pg/orm.compositeAppender.func1(0xc0001c0000, 0x31, 0x1000, 0x131cfe0, 0xc00016a4c0, 0x197, 0x1, 0xc00016a4c0, 0x197, 0x131cfe0)
@ORBAT
ORBAT / sVim.css
Created June 11, 2019 17:20
sVimcss
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {
@ORBAT
ORBAT / sVim.rc
Last active September 19, 2019 13:25
sVimrc
map "d" scrollPageDown
map "shift+d" scrollPageUp
map "g shift+g" scrollToBottom
unmap "g n"
map "g f" gotoNextPage
unmap "g p"
map "g shift+f" gotoPrevPage
map "€" scrollToRight
map "f" createTabbedHint