Skip to content

Instantly share code, notes, and snippets.

View cognominal's full-sized avatar

Stéphane Payrard cognominal

View GitHub Profile
@rgs
rgs / intersect.sh
Created March 15, 2024 12:20
Get the intersection of an arbitrary number of json files with jq
#!/usr/bin/env bash
function intersectJson {
echo $* | \
jq -nS '
def intersect:
.[0] as $a |
.[1] as $b |
if ($a | type) == "object" then
if ($b | type) == "object" then
<h1>Videos Piscine Illustrator</h1>
<h2>D00</h2>
<a href="https://elearning.intra.42.fr/uploads/video/video/1117/Piscine_Illustrator_-_D00_-_00_Re%CC%80gles__repe%CC%80res_et_magne%CC%81tisme.mp4">00_Regles__reperes_et_magnetisme</a><br>
<a href="https://elearning.intra.42.fr/uploads/video/video/1118/Piscine_Illustrator_-_D00_-_01_Les_diffe%CC%81rents_types_de_trace%CC%81s.mp4">01_Les_differents_types_de_traces</a><br>
<a href="https://elearning.intra.42.fr/uploads/video/video/1119/Piscine_Illustrator_-_D00_-_02_Les_Nuanciers.mp4">02_Les_Nuanciers</a><br>
<a href="https://elearning.intra.42.fr/uploads/video/video/1120/Piscine_Illustrator_-_D00_-_03_Les_formes_vectorielles.mp4">03_Les_formes_vectorielles</a><br>
<a href="https://elearning.intra.42.fr/uploads/video/video/1121/Piscine_Illustrator_-_D00_-_04_Plans__arrie%CC%80re-plans_et_calques.mp4">04_Plans__arriere-plans_et_calques</a><br>
<a href="https://elearning.intra.42.fr/uploads/video/video/1122/Piscine_Illustrator_-_D00_-_05_Les_outils_de_dessin.mp4">
@jnthn
jnthn / glr.p6
Last active August 29, 2015 14:26
Great List Re-implementation: initial draft/exploration
# This file contains some work-in-progress bottom-up design work for the GLR.
# All types and operators introduced are prefixed with GLR, so there are no
# conflicts with those in core (the GLR prefix has even been used where there
# isn't anything in core to conflict with, to make clear what's being added).
# There's no syntax sugar, but rather explanations of what some syntax will
# desugar to are included. The various MAIN subs do tests to check correctness
# and various benchmarks to compare with what we have in Rakudo today.
# Up-front summary:
# * (1, 2, 3) makes a List; there is no Parcel. List supports laziness and
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@jbarber
jbarber / chrome-reload
Last active June 30, 2018 17:38
Reload Chrome tabs from the command line with Perl
#!/usr/bin/env perl
=head1 NAME
chrome-reload
=head1 SYNOPSIS
chrome-reload 1
Take a Rakudo repo. Place the above file in src/json.nqp. Build it like this:
nqp --vmlibs=perl6_group,perl6_ops --target=pir --combine src/json.nqp src/gen/main-version.nqp > src/json.pir
Then you can do:
install\bin\parrot.exe src\json.pir -e "say 42"
Which will dump the parse tree as JSON.
@sebfisch
sebfisch / gist:2235780
Created March 29, 2012 10:47
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling

pir::nqp_bigint_setup__v();
my $knowhow := pir::get_knowhow__P();
my $bi_type := $knowhow.HOW.new_type(:name('TestBigInt'), :repr('P6bigint'));
$bi_type.HOW.compose($bi_type);
sub fac_bi($n) {
my $i := $n;
my $r := nqp::box_i(1, $bi_type);
while $i > 1 {