This file contains hidden or 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 List::Util qw(zip) | |
@a = reverse sort map {int(rand 6) + 1} (1..3) | |
print "tirage attaquant: @a\n" | |
@d = reverse sort map {int(rand 6) + 1} (1,2) | |
print "tirage defenseur: @d\n" | |
@r = map {$_->[0] > $_->[1]} ((zip \@a, \@d)[0..1]) | |
$dd = - grep $_ == 1, @r | |
$da = - grep($_ == "", @r) | |
print "dommage attaquant:$da\n" | |
print "dommage défenseur:$dd\n" |
This file contains hidden or 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 List::Util qw(zip) | |
@t = ( [ 3, "attaquant", "" ], [ 2, "defenseur", 1]) | |
map { push @$_, ([reverse sort map {(int rand 6) + 1} (1..$_->[0])]) } @t | |
map { print "tirage $_->[1]: @{$_->[3]}\n" } @t | |
@r = map {$_->[0] > $_->[1]} ((zip $t[0]->[3], $t[1]->[3])[0..1]) | |
map { $v = $_->[2]; push @$_, ( - grep $_ == $v, @r) } @t | |
map { print "domage $_->[1]: $_->[4]\n" } @t |
This file contains hidden or 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
cat /dev/urandom | tr -dc '1-6' | head -c 3 | sed -r 's/(.)/\1\n/g' | sort -r > DA ; echo 'tirage attaquant'; cat DA; cat /dev/urandom | tr -dc '1-6' | head -c 2 | sed -r 's/(.)/\1\n/g' | sort -r > DD ; echo 'tirage défenseur'; cat DD; paste DA DD | head -n 2 | sed -e '1 iA=0; D=0' -e 's/\([1-6]\).*\([1-6]\)/if [[ \1 -le \2 ]]; then A=\$(( A - 1 )); else D=\$(( D - 1 )); fi/' -e '$ aecho attaquant \$A ; echo defenseur \$D ' | bash |
This file contains hidden or 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
#added to .profile | |
(sleep $((20 * 60 )); cvlc --play-and-exit /usr/local/share/sounds/Alarm_or_siren.ogg ; gnome-session-quit --logout ; sleep $(( 2 * 60 )); cvlc --play-and-exit /usr/local/share/sounds/Alarm_or_siren.ogg ; gnome-session-quit --force ; ) & |
This file contains hidden or 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
public class Main { | |
public static void main(String[] args) { | |
System.out.println(Long.toBinaryString(Double.doubleToLongBits(1650e-9))); | |
System.out.println(Long.toBinaryString(Double.doubleToLongBits(1650e-9)).length()); | |
System.out.println(Long.toBinaryString(Double.doubleToLongBits(-1650e-9))); | |
System.out.println(Long.toBinaryString(Double.doubleToLongBits(-1650e-9)).length()); | |
} | |
} | |
// 1111101011 1011101011101011001000101111100100101001010011000011 | |
// 62 |
This file contains hidden or 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
(define (square x) (* x x)) | |
(define (sum-of-squares x y)(+ (square x) (square y))) | |
(define (sum-of-squares-a-max-b-c a b c) | |
(if (< b c) | |
(sum-of-squares a c) | |
(sum-of-squares a b))) | |
(define (sum-of-squares-2-greatests x y z) | |
(if (< x y) | |
(sum-of-squares-a-max-b-c y x z) | |
(sum-of-squares-a-max-b-c x y z))) |
This file contains hidden or 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
# Input: list of rows with format: "<filesize> filename", e.g. | |
# filesizes.txt | |
####################### | |
# 1000K file1.txt | |
# 200M file2.txt | |
# 2G file3.txt | |
# | |
# Output: | |
cat filesizes.txt | numfmt --from=iec | awk 'BEGIN {sum=0} {sum=sum+$1} END {printf "%.0f\n", sum}' |
This file contains hidden or 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
// @match https://*/auth/realms/myrealm/protocol/openid-connect/auth* | |
(function() { | |
'use strict'; | |
var divDuration = document.createElement("div"); | |
divDuration.setAttribute('id', 'userscript_duration'); | |
document.getElementById('kc-header-wrapper').after(divDuration); | |
const start = Date.now(); | |
function update_userscript_duration() { | |
document.getElementById('userscript_duration').innerHTML = ((Date.now() - start) / 1000 / 60).toFixed(1); |
This file contains hidden or 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
// @match https://mygitlab.com/groups/mygroup/-/merge_requests?* | |
(function() { | |
'use strict'; | |
const names = ["alice", "bernard", "etc."]; | |
const projects = ["save-world", "cure-all-diseases"]; | |
const selectors = names.map(name => `div.issuable-info-container div.issuable-info span.issuable-authored a[data-username="${name}"]`) | |
.concat(projects.map(project => `div.issuable-info-container div.issuable-main-info div.merge-request-title span.merge-request-title-text a[href*="/${project}/"]`));; | |
[].filter.call(document.querySelectorAll('main#content-body > ul > li'), li => !selectors.find(selector => li.querySelector(selector))).forEach(li => li.remove()); | |
})(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.