Skip to content

Instantly share code, notes, and snippets.

# SPDX-License-Identifier: Apache-2.0
#
# This is a standalone benchmark to evaluate copy-on-write in Python.
# The goal is to visit all the element of a tree by avoiding the branches that share the same name.
import random, uuid, timeit
# A random tree generator
def gen_name():
return random.choice("abcdefghijklmnopqrstuvwxyz")
module NestedMapReduceTraversal where
data Section = Section String Bool [String]
data NumberedSection = NumberedSection Int String [(Int, String)]
deriving (Show, Eq)
numberSection :: [Section] -> [NumberedSection]
numberSection = go (1, 1)
where
{- The package contains common symbol shared by the other dhall files -}
let Prelude =
env:DHALL_PRELUDE
? https://prelude.dhall-lang.org/v13.0.0/package.dhall sha256:4aa8581954f7734d09b7b21fddbf5d8df901a44b54b4ef26ea71db92de0b1a12
let {- Generate sequence like unix seq command -} seq =
\(count : Natural)
-> let seq = Prelude.List.replicate count Natural 1
let indexed = Prelude.List.indexed Natural seq
@TristanCacqueray
TristanCacqueray / filtered-output.dhall
Created December 1, 2019 17:02
Zuul job generations with dhall (WIP)
let List/map =
https://prelude.dhall-lang.org/v11.1.0/List/map sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
let List/drop =
https://raw.githubusercontent.com/dhall-lang/dhall-lang/master/Prelude/List/drop sha256:af983ba3ead494dd72beed05c0f3a17c36a4244adedf7ced502c6512196ed0cf
let List/take =
https://raw.githubusercontent.com/dhall-lang/dhall-lang/master/Prelude/List/take sha256:b3e08ee8c3a5bf3d8ccee6b2b2008fbb8e51e7373aef6f1af67ad10078c9fbfa
let Prelude =
#!/bin/env python3
import argparse
import json
import sys
import os
import tarfile
import time
import subprocess
from urllib.request import urlopen
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0
import argparse
import multiprocessing
import os, signal, time
import numpy as np
import colorsys
import png
#!/usr/bin/python
# coding: utf-8 -*-
# Copyright (c) 2016 Red Hat
#
# This module 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
# (at your option) any later version.
#
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0
# This is a basic Julia set explorer
import math, pygame, os, time, colorsys, sys
from pygame.locals import *
import pygame.draw, pygame.image
#constants
WINSIZE = map(lambda x: x*3, [ 160, 160])
#!/bin/sh
#
# A demo of Linux namespace to sandbox firefox
#
set -e
echo "[+] Check dependencies"
for i in twm firefox Xnest; do
which $i
@TristanCacqueray
TristanCacqueray / trippy.py
Created June 29, 2015 13:44
Multiplication visualisation on a circle
#!/usr/bin/env python
import math, pygame, os, time, colorsys, sys
from pygame.locals import *
import pygame.draw, pygame.image
#constants
WINSIZE = [ 800, 800]
CENTER = map(lambda x: x/2, WINSIZE)
RADIUS = WINSIZE[0] / 2 - 2