Skip to content

Instantly share code, notes, and snippets.

View ivanursul's full-sized avatar

Ivan Ursul ivanursul

View GitHub Profile
View gist:bf88f18806f5733f43c519b4013e8a0c
#!/bin/sh
cd /home/pi/camera
aws s3 sync . s3://iursul-camera-snapshots
View create-snapshot.sh
#!/bin/sh
cd /home/pi/camera
date=`date '+%Y/%m/%d/'`
time=`date '+%H:%M:%S'`
mkdir -p $date
avconv -y -loglevel debug -rtsp_transport tcp -i "rtsp://admin:Dadmin17@194.44.110.210:37002/cam/realmonitor?channel=1&subtype=0" -q:v 9 -s 1920x1080 -vframes 1 $date$time.png
View Rinkeby
0x3F0B65817dc2CC9768C63f11725489F4B377D008
View gist:088b794c3424e6838fd91605419ab6ec
org.apache.kafka.connect.errors.ConnectException: org.postgresql.util.PSQLException: ERROR: column "device_id" is of type bigint but expression is of type timestamp without time zone
Hint: You will need to rewrite or cast the expression.
Where: PL/pgSQL function "$justone$kafka$connect$sink".flush(character varying,character varying,character varying[],integer[],bigint[]) line 10 at EXECUTE
at com.justone.kafka.sink.pg.json.PostgreSQLSinkTask.flush(PostgreSQLSinkTask.java:402)
at org.apache.kafka.connect.sink.SinkTask.preCommit(SinkTask.java:117)
at org.apache.kafka.connect.runtime.WorkerSinkTask.commitOffsets(WorkerSinkTask.java:305)
at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:164)
at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:148)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:146)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:190)
View gist:bf7b2b100066cf0e4bc4599ffcebf86d
Original documentation: https://github.com/justonedb/kafka-sink-pg-json
1. Place the justone-kafka-sink-pg-json-1.0.jar in the Kafka directory lib
2. Place property names in the config folder:
justone-kafka-sink-pg-json-standalone.properties
justone-kafka-sink-pg-json-connector.properties
3. Configure this files
4. Install the sql file:
psql -U ${user} -h ${host} -d ${database} -f "/Users/ivanursul/Downloads/kafka-sink-pg-json/install-justone-kafka-sink-pg-1.0.sql"
View gist:d98691bb4e2d28d0288273f4a06187fe
int alpha = 3;
int x = 5;
int i = 1;
double iterResult;
double result = 1.0
do {
numVal = 1;
for (int j = 0; j < i; j++) {
View block.json
{
"_id" : "0x458b657b6a87bee3c1f8f4f8f0503bcf93a1a932bcef2e6aa0278557d3da6874",
"_class" : "com.ethereum.api.domain.Block",
"number" : "52534",
"parentHash" : "0xd2168d89c36459fc6701ee7855b3ecff02dfa907f8990c6167ca2b229e127725",
"nonce" : "14288376210181285059",
"sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot" : "0xccd56a560b653f817ef9ce83589d36b068661726b3dbfb9928584766f3f1a571",
"stateRoot" : "0x
View gist:da041fa6916b3978ee0c8041868636ab
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head>
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely -->
<title></title> <!-- The title tag shows in email notifications, like Android 4.4. -->
<!-- Web Font / @font-face : BEGIN -->
<!-- NOTE: If web fonts are not required, lines 10 - 27 can be safely removed. -->
View BracketBalancing.java
import java.util.Arrays;
import java.util.Stack;
public class BracketBalancing {
private final String expression;
public BracketBalancing(String expression) {
this.expression = expression;
}
View Installing OpenCV with Java support on Raspberry PI 1
1)SD Card Formatter - Format SD Card
2)
sudo diskutil unmount /dev/disk2s1
sudo dd if=/Users/ivanursul/Downloads/2017-07-05-raspbian-jessie.img of=/dev/rdisk2 bs=1m
sudo diskutil eject /dev/rdisk2
3)
sudo mv /var/lib/dpkg/info/linux* ./