Skip to content

Instantly share code, notes, and snippets.

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/lazy]])
local package_root = '/tmp/nvim/lazy'
local plugin_folder = function()
local host = os.getenv('HOST_NAME')
if host and (host:find('Ray') or host:find('ray')) then
return [[~/github/ray-x]] -- vim.fn.expand("$HOME") .. '/github/'
else
return ''
@kke
kke / FoneFinder.rb
Created November 30, 2018 13:27
FoneFinder rubygem full sources, related to https://stackoverflow.com/q/53557964/681520
# bin/FoneFinderTest.rb
#!/usr/bin/env ruby
require 'FoneFinder'
puts "Please enter a phone number!"
object = FoneFinder.new(STDIN.gets.chomp)
unless object.invalid
puts "City: #{object.city}"
@kke
kke / install.sh
Created October 11, 2018 11:16
an installer script for a kontena classic node
#!/bin/sh
# # Kontena "Bring your own node" install script
#
# This script will configure and run Kontena Agent on a variety of systems, including MacOS and most Linux distributions and join it to a grid
#
# ## Requirements
#
# * A working Docker installation (`docker run` should work from the command line)
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.3.6 at Thu Nov 9 22:08:54 2017. */
#include "sensor.pb.h"
/* @@protoc_insertion_point(includes) */
#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Automatically generated nanopb header */
/* Generated by nanopb-0.3.6 at Thu Nov 9 22:08:54 2017. */
#ifndef PB_SENSOR_PB_H_INCLUDED
#define PB_SENSOR_PB_H_INCLUDED
#include <pb.h>
/* @@protoc_insertion_point(includes) */
#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
syntax = "proto3";
message SensorReport {
uint32 device_id = 1;
uint32 sensor_id = 2;
uint32 timestamp = 3;
oneof value {
float f = 4;
uint32 percentage = 5;
int32 val = 6;
SensorReport message = SensorReport_init_zero;
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
message.device_id = 1;
message.sensor_id = (uint32_t)2;
message.which_value = SensorReport_f_tag;
message.value.f = currTemp;
status = pb_encode(&stream, SensorReport_fields, &message);
message_length = stream.bytes_written;
if (!status) {
add_message "SensorReport" do
optional :device_id, :uint32, 1
optional :sensor_id, :uint32, 2
optional :timestamp, :uint32, 3
oneof :value do
optional :f, :float, 4
optional :percentage, :uint32, 5
optional :val, :int32, 6
optional :b, :bool, 7
end
@kke
kke / dsl.rb
Last active June 27, 2017 09:00
module Recipe
Version = Class.new(Gem::Version)
class Definition
attr_reader :options
def initialize(recipe_name, options = {})
@options = options
recipe recipe_name
end
stream = Class.new(Queue) { alias_method :write, :push }.new
orig_stdout = $stdout
$stdout = stream
Thread.new do
loop do
puts Time.now
sleep 0.5
end
end