Skip to content

Instantly share code, notes, and snippets.

--- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh
@@ -686,9 +686,10 @@ kube::golang::build_binaries() {
host_platform=$(kube::golang::host_platform)
local goflags goldflags goasmflags gogcflags
- goldflags="${GOLDFLAGS:-} -s -w $(kube::version::ldflags)"
+ goldflags="${GOLDFLAGS:-} $(kube::version::ldflags)"
goasmflags="-trimpath=${KUBE_ROOT}"
- gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"
package main
import (
"image"
"image/color"
"image/png"
"io"
"math/rand"
"net/http"
"time"
@osdrv
osdrv / .vimrc
Created November 15, 2018 16:10
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'rakr/vim-one'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " " alternatively, pass a path where Vundle should install bundles
" " "let path = '~/some/path/here'
" " "call vundle#rc(path)
" "
" " let Vundle manage Vundle, required
@osdrv
osdrv / slp_connect.ex
Last active February 16, 2016 22:55
Connect 2 elixir nodes using slptool
# Node 1
{ :ok, [ { ip_oct = { 192, x, y, z }, _, _ } | tail ]} = :inet.getif()
ip_addr = ip_oct |> Tuple.to_list |> List.join "."
{ "", 0 } = System.cmd("slptool", ["register", "service:my.service://#{ip_addr}"])
case System.cmd("slptool", ["unicastfindsrvs", ip_addr, "service:my.service"]) do
{ "", 0 } -> # consider slpd restart + re-register
{ my_address, 0 } -> # all good
{ error, err_code } -> # handle error
end
# Node 2
defmodule SmartJoin do
defp _join([ el ]), do: el
defp _join([ el2, el1 ]), do: "#{el1} and #{el2}"
defp _join([ el2, el1 | tail ]), do: "#{Enum.join( Enum.reverse(tail), ", " )}, #{join([el1, el2])}"
def join(list), do: _join Enum.reverse(list)
end
Enum.each([
["foo"],
["foo", "bar"],
@osdrv
osdrv / sails_websocket_rest_adapter.js
Last active December 21, 2015 17:39
Ember.js RESTAdapter for Sails.js websocket transport.
(function() {
var isNone = Ember.isNone;
DS.SailsWebSocketRESTAdapter = DS.RESTAdapter.extend({
bulkCommit: false,
serializer: DS.FixedRelationsRESTSerializer,
@osdrv
osdrv / .vimrc
Last active December 18, 2015 12:39
My current .vimrc
set guifont=Monaco:h14
set bg=dark
set ts=2
set sw=2
set sts=2
set expandtab
set nu nu
set syntax=on
highlight clear
syntax reset
@osdrv
osdrv / pin.js
Created May 29, 2013 17:39
Tiny jQuery tool to pin absolute-positioned div in current screen position and unpin it back
;(function() {
var FIXED = 'fixed';
var ABSOLUTE = 'absolute';
var $w = $(window);
window.pin = function(obj) {
var objPos = obj.css('position');
if (objPos == FIXED) return;
var objOffset = obj.offset();
function interPathHelper(path1, path2, justCount) {
path1 = R._path2curve(path1);
path2 = R._path2curve(path2);
var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,
res = justCount ? 0 : [];
for (var i = 0, ii = path1.length; i < ii; i++) {
var pi = path1[i];
if (pi[0] == "M") {
x1 = x1m = pi[1];
y1 = y1m = pi[2];