Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
import {
StyleSheet,
Text,
View,
Button,
} from 'react-native';
class Ready extends React.Component {
render() {
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@jgeraerts
jgeraerts / README
Created December 30, 2017 18:21 — forked from cyclingengineer/README
OpenHAB Heating Control Rules
OpenHAB Heating Example
========================
This heating example shows three rooms in my house with 1 radiator valve, 1 temperature sensor per room and a single boiler. It could be adapted for different situations.
The rules allow for simple addition of items in rooms as long as they follow the naming convention and have at least a valve, a thermometer, setpoint and a demand switch.
The demand switch is purely internal and is used to indicate if the room requires heat or not. All rooms are OR'd together to define the boiler status and each room demand (On/Off) is applied to the radiator valves.
It could be more generic for multiple thermometers/valves per room - but it suits my needs for now. If I make it more generic I will update it accordingly.
/*
* afindep.c - address family independant networking functions
*
* nc6 - an advanced netcat clone
* Copyright (C) 2002-2006 Chris Leishman <chris _at_ leishman.org>
* Copyright (C) 2001-2006 Mauro Tortonesi <mauro _at_ deepspace6.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@jgeraerts
jgeraerts / haproxy.cfg
Last active August 29, 2015 14:07 — forked from rnewson/haproxy.cfg
# Bind SSL port with PFS-enabling cipher suite
bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-RC4-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:RC4-SHA
# Distinguish between secure and insecure requests
acl secure dst_port eq 443
# Mark all cookies as secure if sent over SSL
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure
# Add the HSTS header with a 1 year max-age
@jgeraerts
jgeraerts / image.clj
Created April 7, 2014 21:34 — forked from jkk/image.clj
;; depends on [org.imgscalr/imgscalr-lib "4.2"]
(ns XXX.image
(:refer-clojure :exclude [read])
(:require [clojure.java.io :as io])
(:import [org.imgscalr Scalr Scalr$Method Scalr$Mode]
[java.awt Image]
[java.awt.image RenderedImage BufferedImageOp]
[javax.imageio ImageIO ImageWriter ImageWriteParam IIOImage]
public class FacetValueHash {
public static long hash(String input){
try {
Adler32 adler32 = new Adler32();
adler32.update(input.getBytes("UTF8"));
return adler32.getValue();
} catch (UnsupportedEncodingException e) {
throw new NestableRuntimeException(e);
}
}
@jgeraerts
jgeraerts / SpringThucydidesJUnitStories
Created January 11, 2013 08:21
Load Spring Application with Thucydides JBehave.
public class SpringThucydidesJUnitStories extends ThucydidesJUnitStories {
@Override
public InjectableStepsFactory stepsFactory() {
return SpringAutowiringThucydidesStepFactory.withStepsFromPackage(getRootPackage(), configuration()).andClassLoader(getClassLoader());
}
public static class SpringAutowiringThucydidesStepFactory extends ThucydidesStepFactory {
private static volatile ConfigurableApplicationContext ctx;
@jgeraerts
jgeraerts / Fibonacci.java
Created November 7, 2012 22:57 — forked from abhin4v/Fibonacci.java
Python-style Generator in Java
package net.abhinavsarkar.util;
/**
* A (infinite) Fibonacci number generator.
*
* @author Abhinav Sarkar
*/
public class Fibonacci extends Generator<Integer> {
bzcat access_log-20111103.bz2 | grep "solr-server/select" | sed 's/.* "GET //' | sed 's/ HTTP\/.*//' | sed s/^/http:\\/\\/10.12.2.76/ | wget -i - -O /dev/null