Skip to content

Instantly share code, notes, and snippets.

View Dnomyar's full-sized avatar

Damien RAYMOND Dnomyar

View GitHub Profile
@Dnomyar
Dnomyar / test.scala
Created September 8, 2020 12:49
ZIO stream from callback
# If you wonder how to create a stream from a callback API, you can use this kind of code (note the forever):
# I guess Task can be replaced by other ZIO constructs
ZStream.fromEffect(
Task.effectAsync[T] { cb =>
cb(Task.succeed(...))
}
).forever
@Dnomyar
Dnomyar / main.yml
Created September 5, 2020 16:45
Github action - Compass scss to css and sprite generation
# ...
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# needs config.rb at the root
package example
import cats.effect.{IO, Sync}
import cats.kernel.laws._
import cats.kernel.laws.discipline._
import cats.{Eq, Monad}
import org.scalacheck.Gen._
import org.scalacheck.Prop._
import org.scalacheck._
import org.scalatest._
@Dnomyar
Dnomyar / Graph3d.java
Last active February 7, 2018 12:31
Classification TP with maven
// Replace line :
Chart chart = new Chart();
// by :
Chart chart = new Chart(new AWTChartComponentFactory(), Chart.DEFAULT_QUALITY);
@Dnomyar
Dnomyar / TestConcurrence.java
Created April 21, 2017 07:38
Concurrence test using Stream API (.parallel() method)
public class TestConcurrence {
public static void main(String[] args) {
String address = "http://localhost:8080/servicejava/serverStatefull";
System.out.println("*****************************");
final WebTarget target = AppliCliente.clientJAXRS().target(address);
final Automate automate = WebResourceFactory.newResource(Automate.class, target);
@Dnomyar
Dnomyar / Regex_cli
Created March 22, 2015 20:55
Regex : select all spaces not between quotes
Select all spaces not between quotes
Useful for command line parsing
""" +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"""
Scala example :
scala> val input = "hello world \"john doe\""
input: String = hello world "john doe"
@Dnomyar
Dnomyar / makefile
Last active August 29, 2015 14:13
Makefile JAVA
SRC = src
SOURCES = $(shell find ./src/ -name *.java)
S = java
SC = javac
TARGET = bin
CP = bin
VPATH=bin
run: compile
@echo ":: Executing..."
@Dnomyar
Dnomyar / BombFork.c
Created January 14, 2015 20:28
BombFork
#include <stdio.h>
#include <signal.h>
static void handler(int signum)
{
write(1, "NOPE", 4);
fork();
}
@Dnomyar
Dnomyar / .Xdefaults
Last active April 16, 2022 20:12
My XMonad (xmobar : battery, cpu, memory, volume, time) - ArchLinux
Xcursor.theme: Vanilla-DMZ-AA
!urxvt color scheme:
URxvt*background: #2B2B2B
URxvt*foreground: #DEDEDE
!URxvt*colorUL: #86a2b0
! black