Skip to content

Instantly share code, notes, and snippets.

@muka
muka / install-protoc.sh
Last active March 20, 2018 14:04
How to install protoc to use with grpc
#Get a release here https://github.com/google/protobuf/releases
sudo -s
cd /usr/local/include
mkdir google
wget https://github.com/google/protobuf/releases/download/v3.5.0/protoc-3.5.0-linux-x86_64.zip -O protoc.zip
unzip protoc.zip -d tmp
@muka
muka / ubuntu-termk.md
Created July 7, 2018 10:43
atom terminal with termrk

apm install termrk

To use ctrl+` to toggle

keymap.cson

'atom-workspace':
  'ctrl-\`': 'termrk:toggle'   
@muka
muka / setup.sh
Created July 8, 2018 04:20
gocv / openvino setup
. /data/opt/intel/computer_vision_sdk_2018.2.300/bin/setupvars.sh
. openvino/env.sh
CGO_LDFLAGS="$CGO_LDFLAGS -lopencv_calib3d"
LD_LIBRARY_PATH=/home/l/git/github.com/openvino-docker/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
LD_LIBRARY_PATH=/data/opt/intel/computer_vision_sdk_2018.2.300/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64:$LD_LIBRARY_PATH
export CGO_LDFLAGS
export LD_LIBRARY_PATH
@muka
muka / http-server.sh
Created August 7, 2018 20:00
netcat http server
while [ 1 ]; do
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <index.html)\r\n\r\n"; cat index.html; } | nc -l 8080
done
var mqtt = require('mqtt');
var client1 = mqtt.connect('mqtt://172.20.0.2');
var client2 = mqtt.connect('mqtt://172.20.0.3');
client1.on('connect', function () {
client1.subscribe("foo")
});
client1.on('message', function (topic, message) {
console.log("got msg", topic, message.toString());
@muka
muka / extract-ip.sh
Created October 16, 2018 04:51
Extract the ip from a docker-compose set of container
NET_NAME="project_default"
NAME="nats"
IP=docker network inspect $NET_NAME | grep $NAME -A 3 | grep "IP" | grep -Po "([0-9]+.[0-9]+.[0-9]+.[0-9])"
echo $IP
@muka
muka / gist:f961a62b41bf5ad8f064
Created November 23, 2014 10:15
Start a minicom to show arduino serial
#!/bin/sh
# Usage: ./start_minicom 1 ACM # uses /dev/ttyACM1
#Start a minicom to show arduino serial output
# first argument to set the proper /dev/tty index
# second argument to set the name of /dev/tty index
Didx="0"
Dtype="USB"
@muka
muka / dhcpd.conf
Last active November 21, 2019 07:25
Setup a dhcpd server using docker
ddns-update-style none;
option domain-name "thpi";
option domain-name-servers 208.67.222.222, 208.67.220.220;
default-lease-time 86400;
max-lease-time 604800;
authoritative;
@muka
muka / b2match.js
Created January 22, 2020 14:01
extract a list of people from a b2match API call
const baseUrl = "https://aal-programme-info-day-2020.b2match.io/participants"
const data = require("./data.json")
const participantRow = (participant) => {
let {
id,
user,
organisation_name,
organisation_type,