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
Weights←{ | |
⍝ 2020 APL Problem Solving Competition Phase II | |
⍝ Problem 9, Task 1 - Weights | |
⍝ 1) Read the diagram of a mobile from the file as a vector of lines (M). | |
⍝ 2) Find lines which exactly repeat the preceding lines and contain only | |
⍝ vertical bars (│) and spaces. Such lines don't bring any useful | |
⍝ information. (This filtering step allows to process files which are | |
⍝ very deep without running out of memory. For example, 10K characters | |
⍝ wide, 100K lines deep. Without filtering, such a file would be |
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
<html> | |
<body> | |
<h2>32-bit DJB2 hash in JavaScript demo</h2> | |
<input type="file" id="file-input" /> | |
<h3 id="result">Select file to calculate DJB2 hash</h3> | |
</body> | |
<script> | |
// DJB2 hash function. Takes ArrayBuffer | |
function hash_buf_djb2_32(buf) { |
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
/* Copyright (c) 1998, 2015 Todd C. Miller <[email protected]> | |
* (c) 2021 Andrii Makukha | |
* | |
* Permission to use, copy, modify, and distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
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
#!/usr/bin/env python3 | |
''' | |
Code duplication assessment tool. Runs in linear time. | |
Usage: | |
Put your packages into a single directory and run this script: | |
python3 code_duplication.py > report.txt | |
Then sort files by similarity: | |
cat report.txt | awk 'NF > 1' | sort -rn | less | |
''' |
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
#!/usr/bin/env python3 | |
'''Generate unique random strings or identifiers''' | |
import random, sys | |
# How many new unique identifiers to generate? | |
NUMBER = 100 if len(sys.argv) <= 1 else int(sys.argv[1]) | |
# How many words to combine into a new generated string? | |
LENGTH = 3 if len(sys.argv) <= 2 else int(sys.argv[2]) |
OlderNewer