Skip to content

Instantly share code, notes, and snippets.

require 'set'
require 'prime'
unless ARGV.size == 2
puts "usage: #{__FILE__} letters max-word-length"
exit 1
end
letters = ARGV[0].to_i
max_word_length = ARGV[1].to_i
<?xml version="1.0"?>
<!DOCTYPE jml SYSTEM "file://jml.dtd">
<jml version="1.2">
<pattern>
<title>88888800888888008888880088889700888888008888970088888800888a86008888880088a86800888888008a86880088888800a86888008888880088b88500888888008b88580088888800b885880088888800a86a860088888800b8b5850088888800ab6a560088888800bbb55500</title>
<prop type="ball" mod="color={229,49,114};diam=8"/>
<prop type="ball" mod="color={146,91,154};diam=10"/>
<prop type="ball" mod="color={71,145,199};diam=12"/>
<prop type="ball" mod="color={25,177,166};diam=14"/>
<prop type="ball" mod="color={107,218,128};diam=16"/>
lo=-20
hi=90
width=90
left=-(width/2)
right=(width/2)
balls=6
pos = []
i = 0
rows = 24
columns = 32
blank = '.'
grid = Array.new(rows) { Array.new(columns) }
for row in 0..rows-1
for column in 0..columns-1
grid[row][column] = blank
end
end
@noslowerdna
noslowerdna / gist:0b6e49e199e94a30332737f216478ea0
Created March 6, 2019 15:50
Count number of zeroes and ones in a file
xxd -b my-file | cut -d ' ' -f 2-7 | sed 's/ //g' | awk '{for (i=1;i<=NF;i++) a[$i]++} END{for (c in a) print c,a[c]}' FS=""
private static String formatBytes(double bytes) {
int exp = (int) (Math.log(bytes) / Math.log(1024));
return String.format("%.1f %c%s", bytes / Math.pow(1024, exp), "BKMGTPEZY".charAt(exp), bytes < 1024 ? "" : "B");
}
import cv2
import numpy as np
linewidth = 1
#h = 0
linecolor = (255, 255, 255)
linetype = cv2.LINE_AA
def nothing(arg): pass
1159 497 919 431 1293 958
1174 519 940 416 1276 985
1190 538 962 404 1260 1006
1209 552 984 395 1245 1021
1229 562 1006 388 1230 1029
1250 567 1028 384 1217 1032
1274 569 1050 382 1204 1028
1302 565 1073 383 1191 1018
1333 557 1096 386 1179 1001
1364 544 1120 392 1168 978
File.open('z.csv') do |file|
a=1
fb = {}
puts 'b0x=[]; b0y=[]; b1x=[]; b1y=[]; b2x=[]; b2y=[]'
file.each do |line|
n = line.split(',')
b = [[n[0].to_i,n[1].to_i], [n[2].to_i,n[3].to_i], [n[4].to_i,n[5].to_i]]
sorted = []