Skip to content

Instantly share code, notes, and snippets.

View bjonnh's full-sized avatar
🐈

Jonathan Bisson bjonnh

🐈
View GitHub Profile
(defvar org-screenshot-process nil
"Currently running screenshot process")
;; Because cl is deprecated
(defun plusp (arg)
(if (> arg 0) true nil )
)
(defun org-screenshot-take (&optional delay)
"Take a screenshot and insert link to it at point, if image
display is already on (see \\[org-toggle-inline-images])
screenshot will be displayed as an image
@bjonnh
bjonnh / Redirector.json
Last active April 9, 2024 07:49
A redirector configuration file that allows to get direct access to PDFs for Wiley's publications. (this will not bypass the paywall)
{
"createdBy": "Redirector v3.5.3",
"createdAt": "2020-07-07T19:44:24.659Z",
"redirects": [
{
"description": "Wiley pdf",
"exampleUrl": "https://onlinelibrary.wiley.com/doi/epdf/10.1002/mrc.4283",
"exampleResult": "https://onlinelibrary.wiley.com/doi/pdfdirect/10.1002/mrc.4283",
"error": null,
"includePattern": "(https://onlinelibrary[\\-\\.]wiley[\\-\\.]com[a-z\\-\\.]*)/doi/epdf/(.*)",
;;; lsp-sparql.el --- lsp-sparql config -*- lexical-binding: t; -*-
;; Copyright (C) 2020 lsp-mode developers
;; Author: Jonathan Bisson <[email protected]>
;; Keywords:
;; 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 3 of the License, or
@bjonnh
bjonnh / fuzzy_arrays.py
Last active April 4, 2020 21:57
Python fuzzy arrays
import random
import math
class FuzzyArray:
def __init__(self, *content):
self.content = content
def __getitem__(self, index):
low_index = math.floor(index)
high_index = math.ceil(index)
if (high_index>=len(self.content)):
@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
/*
@SolrDocument(solrCoreName = "indexedcitation")
class IndexedCitation {
@Id
@Indexed(name = "id", type = "string")
private var id: String? = null
@Indexed(name = "title", type = "string")
// This is the class with
/*
@SolrDocument(solrCoreName = "indexedcitation")
data class IndexedCitation(
@Id
@Indexed(name = "id", type = "string")
private var id: String? = null,
// 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 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

Some diagrams test

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

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