Skip to content

Instantly share code, notes, and snippets.

View bjonnh's full-sized avatar
🐈

Jonathan Bisson bjonnh

🐈
View GitHub Profile
package net.nprod.mnwe
import javafx.scene.input.KeyCombination
import tornadofx.*
class MainView: View() {
override val root = tabpane {
tab("1") {
button("Click me") {
fun run(): arrow.core.Tuple2<IO<ResultSet>, () -> kotlin.Unit> {
val (localExec, cancelQuery) = fxCancellable {
createQueryExecutionInExternalLib(…Some query…) // returns immediately with an object that allows to abort
}
val (localResult, cancelResult) = fxCancellable {
localExec.bind().executequery() // Blocking task
}
return fx { localResult.bind() } toT {
MAXIONS = 3
intensite=[1000,20,30,100,1000]
masse=[1,2,3,4,5]
intensite,masse = zip(*sorted(zip(intensite,masse))[-MAXIONS:])
print(intensite,masse)
class TableRow(col1: String, col2: String, col3: String): BaseDataComponent() {
var col1 by obs(col1)
var col2 by obs(col2)
var col3 by obs(col3)
}
override fun start(state: Map<String, Any>) {
I18n.manager =

Some diagrams test

{% highlight 'text' %} Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response {% endhighlight %}

/**
* This is a MWE on how to reuse the data classes of your Spring Boot application for other scripts
* I had to do that so I could have a script that extract informations from the DB without going through the API
*/
package com.example
import com.support.DataElement
import org.springframework.boot.Banner
import org.springframework.boot.CommandLineRunner
import org.springframework.boot.autoconfigure.SpringBootApplication
// Hami->FreqsFiltered is a *double
// Hami->IntensFiltered is a *double
// TheoreticalSpec.Points is a *double
double LW = 2, Offset = 2000, FreqStep = 1 , tmp = 0 , tmp1 = 0, sqLW = LW * LW, CurrFreq=0;
for (int i = 1; i <= 131072; i++) {
CurrFreq = Offset - FreqStep * (i - 1);
tmp1 = 0;
for (int j = 1; j <= Hami->nFreqsFiltered; j++) {
tmp = CurrFreq - Hami->FreqsFiltered[j];
// This is the class with
/*
@SolrDocument(solrCoreName = "indexedcitation")
data class IndexedCitation(
@Id
@Indexed(name = "id", type = "string")
private var id: String? = null,
/*
@SolrDocument(solrCoreName = "indexedcitation")
class IndexedCitation {
@Id
@Indexed(name = "id", type = "string")
private var id: String? = null
@Indexed(name = "title", type = "string")
@bjonnh
bjonnh / workshop_touchrgb.py
Created December 21, 2019 00:08
Playing with the fomu hacker edition. Light the RGB leds according to the touch sensors status.
#!/usr/bin/env python3
# This variable defines all the external programs that this module
# relies on. lxbuildenv reads this variable in order to ensure
# the build will finish without exiting due to missing third-party
# programs.
LX_DEPENDENCIES = ["icestorm", "yosys", "nextpnr-ice40"]
#LX_CONFIG = "skip-git" # This can be useful for workshops
# Import lxbuildenv to integrate the deps/ directory
import os,os.path,shutil,sys,subprocess