Skip to content

Instantly share code, notes, and snippets.

💭
our world is a cargo ship and we are all containers to be shipped

Ido Kanner ik5

💭
our world is a cargo ship and we are all containers to be shipped
  • :::1
View GitHub Profile
@ik5
ik5 / concat-wav.go
Created Mar 8, 2020
example on concating two (or more) wav files
View concat-wav.go
package main
import (
"io"
"io/ioutil"
"github.com/moutend/go-wav"
)
func main() {
@ik5
ik5 / audio_windows.go
Last active Feb 20, 2020
Quick and dirty audio playing for MS Windows (No error validation) in Golang
View audio_windows.go
// +build windows
package main
import (
"fmt"
"path/filepath"
"syscall"
"unsafe"
)
@ik5
ik5 / build.sh
Created Jan 2, 2020
shared object from go to c (re-take)
View build.sh
#!/usr/bin/env sh
echo "Building go library:"
go build -o libtest.so -buildmode=c-shared ./main.go || exit
echo "Building C executible:"
clang --verbose -DUSE_SHARED_LLVM=on -L/tmp/so -ltest -I/tmp/so main.c -o main -Wall || exit
echo "Done"
@ik5
ik5 / run-workers.sh
Created Jul 26, 2019
Creating 10 workers, takes the host ip using docker
View run-workers.sh
#!/usr/bin/env bash
declare -i min=0
declare -i max=10
host=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
for (( c=min; c<max; c++ )) do
echo "Going to start worker # $c"
docker run\
@ik5
ik5 / language-layout.vue
Created Jul 22, 2019
solving layout changes in Vue.js
View language-layout.vue
<template>
<ul class="language-selector">
<li
v-for="(language, idx) in $i18n.availableLocales"
:class="{selected: language === $i18n.locale}"
>
<a @click="changeLayout(language, $t(`languages.list[${idx}].bidi`))>
<Flag
:country="$t(`languages.list[${idx}].country-code`)"
:title="language"
@ik5
ik5 / custom_json_unmarshal.go
Created Jun 25, 2019
Example of custom unmarshal of JSON in golang
View custom_json_unmarshal.go
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type To []string
@ik5
ik5 / schema-bad
Created Jun 25, 2019
simple schema for blog post
View schema-bad
From - String
To - String/List of string
Message - String
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ik5
ik5 / int_to_ip.rb
Created Jun 5, 2019
short script to convert 32 bit integer to IPv4
View int_to_ip.rb
#!/usr/bin/env ruby
require 'ipaddr'
ARGV.each do |int|
puts "#{int} = #{IPAddr.new(int.to_i, Socket::AF_INET).to_s}"
end
View vim_cheatsheet.md

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
You can’t perform that action at this time.