This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Video Quality | |
# The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, | |
# and 51 is worst quality possible. A lower value generally leads to higher | |
# quality, and a subjectively sane range is 17–28 | |
QUALITY=28 | |
# check if slop command exists | |
if ! command -v slop &> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $l = Lock.new; my %h; for 1..10 { my $p = start { sleep rand; $l.protect: { say "-- ", $p.WHERE; say %h.elems; %h{$p.WHERE}:delete; say %h.elems } }; say "+", $p.WHERE; %h{$p.WHERE} = $p; }; await %h.values; note %h.elems |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timo@schmand /tmp> perl6 --profile=heap testshellmem.p6 shell | |
Before shell call : 101.664 kb | |
html is 230457 chars | |
After shell call : 210.332 kb | |
After forced gc: 249.704 kb | |
html is 230457 chars | |
After shell call : 323.016 kb | |
After forced gc: 354.232 kb | |
html is 230457 chars | |
After shell call : 401.640 kb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar g{ | |
token garble {<[2]>}; | |
token alpha1 {<[2]>}; | |
token beta { <[q]> }; | |
token delta {<+garble +beta>}; | |
token delta1 {<+garble>}; | |
token delta2 {<+alpha1 +beta>} | |
} | |
say so "2" ~~ /<g::delta1>/; # OK | |
say so "2" ~~ /<g::delta2>/; # OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Test; | |
sub combinations_with_replacement(@iterable, $r) { | |
gather { | |
cwr(@iterable, [], $r); | |
} | |
} | |
sub cwr(@iterable, @state, $r) { | |
my $place = @state.elems; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl6 | |
use NativeCall; | |
my $samplerate = 44100; | |
my $frequency = 440; | |
sub gen-sin(Int $sample-rate, Int $frequency) { | |
my num $spf = $sample-rate.Num / $frequency.Num; | |
my num $twopi = (2 * pi).Num; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# The Great Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# | |
# contributed by Christoph Bauer | |
# converted into Perl by Márton Papp | |
# | |
my num $pi = 3.141592653589793e0; | |
my num $solar_mass =(4 * $pi * $pi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.2 | |
import subprocess, re | |
matchers = { | |
'../scripts/public-add': re.compile('[AM]\tpublic/[\w.]'), | |
'../scripts/public-del': re.compile('D\tpublic/[\w.]'), | |
} | |
for line in subprocess.check_output(["git", "show", "--name-status"]).decode().split('\n')[4:-1]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hey! | |
This is a poll about VMs for Perl 6. It would be awesome if you fill it, | |
just write a comment with your answers. | |
I need it because I work on a huge summary (including, among the others, statistics, tests) | |
of VMs and Perl 6 itself. | |
Thank you very much in advance! | |
sergot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub agm( $a is copy, $g is copy ) { | |
($a, $g) = ($a + $g)/2, sqrt $a * $g | |
until abs($a - $g) < 0.000001; | |
return $a; | |
} | |
say agm 1, 1/sqrt 2; |
NewerOlder