Skip to content

Instantly share code, notes, and snippets.

@karlp
karlp / luasrc-controller-demo.lua
Last active August 29, 2015 14:10
luci json post quirk
--[[
just tries to parse the json posted and reply ok/NAK
--]]
module("luci.controller.rme.demo", package.seeall)
local http = require("luci.http")
local protocol = require("luci.http.protocol")
local json = require("dkjson")
--local json = require("luci.json")
function index()
$ git pull origin usbmaster --dry-run
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 25 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (25/25), done.
From github.com:karlp/karlnet
* branch usbmaster -> FETCH_HEAD
There are no candidates for merging among the refs that you just fetched.
Generally this means that you provided a wildcard refspec which had no
matches on the remote end.
// Router config....
from("direct:pairing")
.setHeader(Exchange.FILE_NAME, BeanLanguage.bean(FilenameGenerator.class, "generatePairingFilename"))
.to("velocity:/conax/Pairing.vm")
.to(conaxDestinationURI);
// conaxDestinationURI = "ftp://conaxTest@localhost:2121/autreq/req?passiveMode=true&password=conaxTest&tempFileName=${file:name}.tmp"
// fails when the ftp server's idle timeout is less than the delay...
from("ftp://blah?move=.processed")
.to("bean:fileParser")
.delay(20 * 1000)
.beanRef("conanCore", "updateOperationOk")
;
FATAL [org.apache.camel.component.file.remote.FtpConsumer:CamelThread 5] - <Consumer Consumer[myFtpEndpointURI] could not poll endpoint: myFtpEndpointURI caused by: org/apache/camel/impl/LoggingExceptionHandler>
java.lang.NoClassDefFoundError: org/apache/camel/impl/LoggingExceptionHandler
at org.apache.camel.impl.DefaultConsumer.getExceptionHandler(DefaultConsumer.java:58)
at org.apache.camel.impl.DefaultConsumer.handleException(DefaultConsumer.java:88)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:277)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:137)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:103)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:98)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndRe
FATAL [org.apache.camel.component.file.remote.FtpConsumer:CamelThread 4] - <Consumer Consumer[myFtpEndpointURI] could not poll endpoint: myFtpEndpointURI caused by: org/apache/camel/util/ObjectHelper$ExceptionIterator>
java.lang.NoClassDefFoundError: org/apache/camel/util/ObjectHelper$ExceptionIterator
at org.apache.camel.util.ObjectHelper.createExceptionIterator(ObjectHelper.java:1158)
at org.apache.camel.processor.exceptionpolicy.DefaultExceptionPolicyStrategy.createExceptionIterator(DefaultExceptionPolicyStrategy.java:205)
at org.apache.camel.processor.exceptionpolicy.DefaultExceptionPolicyStrategy.getExceptionPolicy(DefaultExceptionPolicyStrategy.java:65)
at org.apache.camel.processor.ErrorHandlerSupport.getExceptionPolicy(ErrorHandlerSupport.java:84)
at org.apache.camel.processor.RedeliveryErrorHandler.handleException(RedeliveryErrorHandler.java:270)
at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:101)
This is without having a file name pattern match filter
FATAL [org.apache.camel.component.file.remote.FtpConsumer:CamelThread 4] - <Consumer Consumer[ftp://sms02@localhost:2121/autreq/ok?delay=5000&maxMessagesPerPoll=50&move=.processed&passiveMode=true&password=sms02] could not poll endpoint: ftp://sms02@localhost:2121/autreq/ok?delay=5000&maxMessagesPerPoll=50&move=.processed&passiveMode=true&password=sms02 caused by: Java heap space>
java.lang.OutOfMemoryError: Java heap space
at java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:613)
at java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:652)
at org.apache.camel.impl.DefaultExchange.getProperties(DefaultExchange.java:168)
at org.apache.camel.impl.DefaultExchange.setProperty(DefaultExchange.java:153)
String binarySolo = "01001001 01100110 00100000 01111001 01101111 01110101 00100000 01100011 01100001 01101110 00100000 01110010 01100101 01100001 01100100 00100000 01110100 01101000 01101001 01110011 00101100 00100000 01111001 01101111 01110101 00100000 01100001 01110010 01100101 00100000 01110101 01101110 01100101 01101101 01110000 01101100 01101111 01111001 01100101 01100100";
for (String seg : binarySolo.split(" ")) {
System.out.print((char)Integer.parseInt(seg, 2));
}
@karlp
karlp / _etc_init.d_mosquitto
Created August 25, 2011 14:02
using daemon to make a respawning mosquitto server
#! /bin/bash
# Based on /etc/init.d/sshd as it came on CentOS 5.6:
#
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: Jiri Smid <feedback@suse.de>
# /etc/init.d/mosquitto
#
@karlp
karlp / modbus_master.c
Created September 7, 2011 19:27
libmodbus sample master, always gets errno == 9 for all operations after it's connected (but still works just fine)
#include <stdio.h>
#include <errno.h>
#include <modbus.h>
int main(int argc, char **argv) {
modbus_t *mb;
uint16_t tab_reg[32];
int rc;