Skip to content

Instantly share code, notes, and snippets.

View spaceCamel's full-sized avatar

A. Mecca spaceCamel

  • London, United Kingdom
View GitHub Profile
@spaceCamel
spaceCamel / cozy_deb_install.sh
Last active February 15, 2017 12:59
Cozy Installation Script
# Import the repository public key
wget https://debian.cozycloud.cc/cozy.gpg.key -O /etc/apt/trusted.gpg.d/cozy.gpg
# Add the Cozy repository to the software sources
echo 'deb https://debian.cozycloud.cc/debian jessie cozy' > /etc/apt/sources.list.d/cozy.list
# Install Cozy
apt-get update
apt-get -y install python-cozy-management
cozy_management install_cozy
@spaceCamel
spaceCamel / NOTES.md
Last active March 20, 2020 17:20
PulseAudio + Bluetooth Headset

After updating the configuration

nixos-rebuild switch

I had to restart the system for pulseaudio to load the bluetooth module.

pactl list should show the bluetooth module.

As I'm not using a desktop-manager I've configured the device from the command line following ArchLinux instructions

@spaceCamel
spaceCamel / JacksonFloatingPointNumberTest.groovy
Last active August 29, 2015 14:20
Jackson and floating-point numbers
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.JsonProcessingException
import com.fasterxml.jackson.databind.JsonSerializer
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.module.SimpleModule
import spock.lang.Specification
import java.math.RoundingMode
{
"insurer": {
"_MATCH": "QGL5"
},
"netPremium": {
"_MATCH": 133.39
},
"endorsements": [
"E250"
],
@spaceCamel
spaceCamel / Uri.java
Created March 20, 2014 12:16
A Uri interface
interface Uri
{
String getScheme()
Uri.Hierarchy getHierarchy()
Optional<String> getQuery()
Optional<String> getFragment()
@spaceCamel
spaceCamel / GitHubApiTest
Created June 4, 2013 11:51
Spock Test of a simple request to the GitHub api that fails for HttpBuilder but works via the URL.text
package com.qmetric.renewal.githubapi
import groovy.json.JsonSlurper
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.RESTClient
import spock.lang.Specification
import static groovyx.net.http.ContentType.JSON
class GitHubApiTest extends Specification
mysql> select * from locayta_field where source_name = 'Ersatzteilkategorie';
+------+---------+-----------------------------------------------------+-----------+---------------------+--------+
| id | shop_id | name | type | source_name | weight |
+------+---------+-----------------------------------------------------+-----------+---------------------+--------+
| 4594 | 1673 | ATTRIBUTE_19fc88b8f05301119676260f745102ac_PartType | ATTRIBUTE | Ersatzteilkategorie | 3 |
| 5082 | 1676 | ATTRIBUTE_ApplianceType | ATTRIBUTE | Ersatzteilkategorie | 3 |
| 6144 | 1679 | ATTRIBUTE_ApplianceType | ATTRIBUTE | Ersatzteilkategorie | 3 |
+------+---------+-----------------------------------------------------+-----------+---------------------+--------+
3 rows in set (0.01 sec)
/*
TOMATO TIMER
CIRCUIT:
5 red leds, 1 green, 1 button
STATES:
STOPPED, COUNTING, HOLD (show period number), TOMATO_COMPLETED
DESCRIPTION
The timer when plugged is in STOPPED state, waiting for the button to be pressed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Edit</title>
<style type="text/css">
ul.properties {
list-style: none;
<html>
<body>
<!-- REPLACE THIS -->
<div class="buttons">
<g:form>
<g:hiddenField name="id" value="\${${propertyName}?.id}" />
<span class="button"><g:actionSubmit class="edit" action="edit" value="\${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
<span class="button"><g:actionSubmit class="delete" action="delete" value="\${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('\${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>