Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View todvora's full-sized avatar

Tomas Dvorak todvora

View GitHub Profile
@todvora
todvora / .travis.yml
Created June 20, 2014 12:55
Travis CI as a JS/CSS linter
language: node_js
node_js:
- "0.11"
install:
- npm install jshint -g
- npm install PrettyCSS -g
script:
- jshint main.js
- prettycss main.css
@todvora
todvora / Mailgun.java
Created August 14, 2014 16:08
Mailgun Java Example
public static Response SendSimpleMessage() {
Client client = ClientBuilder.newClient();
client.register(HttpAuthenticationFeature.basic("api", "key-################################"));
WebTarget target = client.target("https://api.mailgun.net/v2/sandbox################################.mailgun.org/messages");
MultivaluedMapImpl formData = new MultivaluedMapImpl();
formData.add("from", "Mailgun Sandbox <postmaster@sandbox################################.mailgun.org>");
formData.add("to", "Tomas Dvorak <todvora@gmail.com>");
formData.add("subject", "Hello Tomas Dvorak");
formData.add("text", "Congratulations Tomas Dvorak, you just sent an email with Mailgun! You are truly awesome! You can see a record of this email in your logs: https://mailgun.com/cp/log . You can send up to 300 emails/day from this sandbox server. Next, you should add your own domain so you can send 10,000 emails/month for free.");
return target.request(MediaType.APPLICATION_FORM_URLENCODED).post(Entity.
@todvora
todvora / Chickens.java
Created October 21, 2014 15:18
Chickens
/**
* https://plus.google.com/114134834346472219368/posts/CR1ZoNe9ojQ
*
* Three farmers were selling chickens at the local market.
* One farmer had 10 chickens to sell, another had 16 chickens to sell,
* and the last had 26 chickens to sell. In order not to compete with
* each other, they agreed to all sell their chickens at the same price.
* But by lunchtime, they decided that sales were not going so well,
* and they all decided to lower their prices to the same lower price point.
* By the end of the day, they had sold all their chickens.
@todvora
todvora / analyze-all.sh
Created May 20, 2015 05:43
Variety.js - analyze all available collections
#!/usr/bin/env bash
# the database name, that will be analyzed
DATABASE_NAME="test"
# read all collection names, using mongo shell
COLLECTIONS=$(mongo $DATABASE_NAME --eval "db.getCollectionNames().join('\n');" --quiet)
echo -e "Found collections: \n$COLLECTIONS"
@todvora
todvora / StreamOfOptional.java
Created October 30, 2015 10:11
Lazy optional stream
package optional;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.Stream;
public class StreamOfOptional {
public static void main(String[] args) {
System.out.println("--Before eager--");
@todvora
todvora / elit-cz.md
Created November 18, 2015 15:32
ecat.elit.cz adblock rules
ecat.elit.cz##.overlay
ecat.elit.cz##.modalBackgroud
ecat.elit.cz###ctl00_inline_content_not_logged
ecat.elit.cz###ctl00_divEmptyDarkOverlayVisible
@todvora
todvora / some_links.md
Created February 20, 2016 17:33 — forked from rponte/some_links.md
Some interesting articles about JPA/Hibernate Multi-Tenancy
@todvora
todvora / 75_76.diff
Created April 14, 2016 13:56
Send to Kindle diff between 1.0.2.75 and 1.0.2.76. More details: http://www.tomas-dvorak.cz/posts/dear-amazon-let-me-fix-that-for-you/
diff --git a/META-INF/manifest.mf b/META-INF/manifest.mf
index 8eb1362..49c8475 100644
--- a/META-INF/manifest.mf
+++ b/META-INF/manifest.mf
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
Name: install.rdf
Digest-Algorithms: MD5 SHA1
-MD5-Digest: MjbpC9Ic30mQUVP+1HnYLg==
-SHA1-Digest: UtuAzxG6Ya00Agg36+3+zYL00lM=
@todvora
todvora / eet.log
Created July 8, 2016 18:07
EET log
2016-07-08 13:55:34.029 [main] INFO cz.tomasdvorak.eet.client.logging.WebserviceLogging - Outbound Message
---------------------------
ID: 1
Address: https://pg.eet.cz:443/eet/services/EETServiceSOAP/v2
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=["http://fs.mfcr.cz/eet/OdeslaniTrzby"]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1"><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-bc4f4614-981f-4c61-a081-316ae3517227">MIID6zCCAtOgAwIBAg
@todvora
todvora / ws.log
Created July 9, 2016 07:31
EET WS log
2016-07-09 09:31:25.719 [main] INFO cz.tomasdvorak.eet.client.logging.WebserviceLogging - Outbound Message
---------------------------
ID: 1
Address: https://pg.eet.cz:443/eet/services/EETServiceSOAP/v2
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=["http://fs.mfcr.cz/eet/OdeslaniTrzby"]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1"><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-b2d27ebc-7e12-44d3-b5ab-14a27f9cad4e">MIID6zCCAtOgAwIBAg