Skip to content

Instantly share code, notes, and snippets.

@rtatol
rtatol / Iframe cross-document messaging example (Iframe)
Created May 17, 2018 08:16
Iframe cross-document messaging example (Iframe)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframe cross-document messaging example (Iframe)</title>
</head>
<body>
<div>
<p>Frame</p>
<p id="messageBox">message</p>
@rtatol
rtatol / MissingInteger.java
Created February 1, 2018 17:23
MissingInteger.java
import java.util.*;
class Solution {
public int solution(int[] A) {
int minimal = 1;
final Set<Integer> set = new HashSet<>(A.length);
@rtatol
rtatol / LINUX UTILS
Last active April 14, 2017 16:51
LINUX UTILS
find out top 10 largest file/directories
du -a /var | sort -n -r | head -n 10
find -type f -exec du -Sh {} + | sort -rh | head -n 5
ncdu /
@rtatol
rtatol / LoggingClientHttpRequestInterceptor.java
Created March 15, 2017 12:41 — forked from jkuipers/LoggingClientHttpRequestInterceptor.java
RestTemplate-interceptor that logs outgoing requests and resulting responses
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.util.StreamUtils;
@rtatol
rtatol / cmd.sh
Created January 15, 2016 14:34 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@rtatol
rtatol / rpi reboot wifi when internet connection is down
Last active August 29, 2015 14:22
raspberry-pi reboot wifi when internet connection is down
#!/bin/bash
# auto reconnect wifi
# test connection ip
TESTIP=google.pl
#192.160.0.1
# ping
ping -c4 ${TESTIP} > /dev/null
{
"create_window_at_startup": false,
"font_size": 10,
"hot_exit": false,
"remember_open_files": false,
"tab_size": 4,
"translate_tabs_to_spaces": true
}
jdbc:h2:~/test;MODE=MySql;DB_CLOSE_DELAY=-1;CACHE_SIZE=65536;AUTO_SERVER=TRUE;
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->