Skip to content

Instantly share code, notes, and snippets.

View stefanobaghino's full-sized avatar
🤔
Thinking

Stefano Baghino stefanobaghino

🤔
Thinking
View GitHub Profile
@stefanobaghino
stefanobaghino / main.c
Last active November 3, 2023 16:18
Shuffle an array
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void shuffle(int array[], size_t n) {
if (n > 1) {
size_t i;
for (i = n - 1; i > 0; i--) {
size_t j = rand() % (i + 1);
int tmp = array[j];
@stefanobaghino
stefanobaghino / lib.rs
Created June 24, 2022 12:01
Simple Sudoku solver in Rust
use enumset::{EnumSet, EnumSetType};
#[derive(EnumSetType, Debug)]
pub enum Token {
_1,
_2,
_3,
_4,
_5,
_6,
@stefanobaghino
stefanobaghino / daml-20200424.txt
Last active April 20, 2021 08:25
Harvester raw output with extension:daml on 2020.04.24
https://raw.githubusercontent.com/agrawald/daml-java-bot/0aeb0e8be314172e014f57dff584e4dd7cae4a6b/daml/Iou.daml
https://raw.githubusercontent.com/agrawald/daml-java-bot/0aeb0e8be314172e014f57dff584e4dd7cae4a6b/daml/IouTrade.daml
https://raw.githubusercontent.com/agrawald/daml-java-bot/0aeb0e8be314172e014f57dff584e4dd7cae4a6b/daml/Main.daml
https://raw.githubusercontent.com/agrawald/daml-java-bot/0aeb0e8be314172e014f57dff584e4dd7cae4a6b/daml/Tests/Iou.daml
https://raw.githubusercontent.com/agrawald/daml-java-bot/0aeb0e8be314172e014f57dff584e4dd7cae4a6b/daml/Tests/Trade.daml
https://raw.githubusercontent.com/aherrmann/drml/02b8eb4fd5fce390dfb8d646cf14b58d1da31ef0/daml/drml/Iou.daml
https://raw.githubusercontent.com/aherrmann/drml/4e5e87ded935d0f77bdface0ae9f7b3f6d853059/daml/drml/Book.daml
https://raw.githubusercontent.com/aherrmann/drml/bd25202f3a97c276e780e46fa2ef551f5c3fc8e6/daml/drml/Bankruptcy.daml
https://raw.githubusercontent.com/akshlawange/DAH/f9cce255aa3dc72eff0d51fe16aaa7e5c1fc63b3/daml/Main/Cash.dam
public interface Animal {
String salutation();
}
@stefanobaghino
stefanobaghino / Dockerfile
Last active December 19, 2017 18:38
Error while running a dockerized Airflow that uses Mesos as a distributed executor - FIXED
FROM python:2.7-jessie
LABEL maintainer="Teralytics AG"
LABEL version=1
# Mesos-related image build-time arguments
ARG MESOS_VERSION=1.0.1
ARG MESOS_VERSION_QUALIFIER=2.0.93.debian81
# Airflow-related image build-time arguments
ARG AIRFLOW_VERSION=1.8.1
object Person {
def unapply(arg: Person): Option[(String, Int, Boolean)] =
Some(arg.name, arg.age, arg.valid)
}
trait Person {
def name: String
def age: Int
def valid: Boolean
}
Welcome to Scala 2.11.8 (OpenJDK 64-Bit Server VM, Java 1.8.0_131).
Type in expressions for evaluation. Or try :help.
scala> :paste
// Entering paste mode (ctrl-D to finish)
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
class RequestType {}
This file has been truncated, but you can view the full file.
ProblemType: Crash
Architecture: amd64
CrashCounter: 1
CurrentDesktop: Unity:Unity7
Date: Wed Jun 14 13:29:19 2017
DistroRelease: Ubuntu 17.04
ExecutablePath: /usr/lib/pony/0.14.0-3301.681301f/bin/ponyc
ExecutableTimestamp: 1494067046
ProcCmdline: ponyc - main.pony
ProcCwd: /home/ste/Projects/stefanobaghino/pony-playground
@stefanobaghino
stefanobaghino / Point.scala
Created May 12, 2017 14:29
scalameter PrimitivePickler for generic use cases
case class Point(x: Double, y: Double)
~ ⇸ scala -cp config-1.3.1.jar:pureconfig_2.11-0.5.0.jar:shapeless_2.11-2.3.2.jar
Welcome to Scala version 2.11.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_121).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.typesafe.config.ConfigFactory.parseString
import com.typesafe.config.ConfigFactory.parseString
scala> import pureconfig._
import pureconfig._