Skip to content

Instantly share code, notes, and snippets.

View 13k's full-sized avatar

K 13k

View GitHub Profile
@13k
13k / openpgp.md
Last active August 20, 2023 22:46
Keyoxide
@13k
13k / migrate-create-tests.cmd
Created December 4, 2019 08:46
Migrate create Windows tests (df00bdc095175d7f0026b11813bd21ec1fb61914)
rem "migrate create" Windows tests
mkdir migs
rem ==============================
rem bad digits
rem ==============================
migrate.exe create -dir migs -ext .sql -seq -digits 0 bad_digits
@13k
13k / home_page.go
Last active January 18, 2019 13:57
Flutter in Go (https://divan.github.io/posts/flutter_go) - Functional options approach
func (m *MyHomePage) Build(ctx BuildContext) Widget {
return NewScaffold(
ScaffoldWithAppBar(
NewAppBar(
AppBarWithTitle(
NewTitle(
TitleWithText(NewText(TextWithText("My home page"))),
),
),
),
# Documentation: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class ExampleApp < Formula
desc ""
homepage ""
url "http://example.com/example_app-1.0.tar.gz"
version "1.0"
sha256 ""
@13k
13k / foundation.go
Last active September 20, 2022 16:23
Accessing Foundation Framework from Go with cgo
// How to build: "CC=clang go build"
package main
import (
"fmt"
"net/url"
"strconv"
"unsafe"
)
@13k
13k / gvm_auto.sh
Last active August 29, 2015 14:17
# Based on chruby's auto feature
# https://github.com/postmodern/chruby/blob/bfd78880fbbbf13635e1f97f83225c6a03ca6e89/share/chruby/auto.sh
function gvm_auto() {
local dir="$PWD/" version
until [[ -z "$dir" ]]; do
dir="${dir%/*}"
if { read -r version <"$dir/.go-version"; } 2>/dev/null || [[ -n "$version" ]]; then
@13k
13k / automount_nfs_osx.md
Created December 17, 2014 01:04
Automount NFS exports in OSX

Linux server

Install NFS.

Add to /etc/exports:

<export_path>   <network>/24(rw,nohide,insecure,no_subtree_check,sync,all_squash,anonuid=1000,anongid=1000)
@13k
13k / 127.0.0.1.txt
Created November 28, 2014 20:00
curl bug
$ curl 127.0.0.1:9200
{
"status" : 200,
"name" : "Stonewall",
"version" : {
"number" : "1.3.4",
"build_hash" : "a70f3ccb52200f8f2c87e9c370c6597448eb3e45",
"build_timestamp" : "2014-09-30T09:07:17Z",
"build_snapshot" : false,
"lucene_version" : "4.9"
require "benchmark/ips"
state1 = :initial
state2 = "initial"
Benchmark.ips do |x|
x.report("<Symbol> => (<String>, <Symbol>)") do
case state1
when "initial", :initial
a = 1
@13k
13k / mappings.rb
Last active August 29, 2015 14:02
class Target
class_attribute :index_mappings
class << self
def mappings(*args, &block)
self.index_mappings ||= { options: {}, mappings: {} }
mappings = nil
options = nil