Skip to content

Instantly share code, notes, and snippets.

View pgblu's full-sized avatar

Philipp Blume pgblu

  • SUONO MOBILE USA
  • Champaign, IL
View GitHub Profile
<h1>(((Title)))</h1>
<div style="display:flex;justify-content:center;align-items:center;width:100%;clear:both;text-align:center">
<span style="max-width:450px;"><img:(((Image id)))></span>
</div>
<p>(((Instruction paragraph)))</p>
<p>(((Instruction paragraph)))</p>
<!--- more as needed ---!>
<p><a href="https://f-puzzles.com/?id=(((puzzleID)))">F-puzzles link</a></p>
@pgblu
pgblu / 7_queens.txt
Last active October 13, 2020 21:15
All sudoku grids with 7 queens, including rotation & reflection but not transposition
Here are the 24 arrangements of sudoku numbers such that each placed digit behaves like a queen, i.e., no instance of a given digit "sees" a copy of itself along a diagonal. They are in no particular order. In each grid, digits 1-7 are represented, and 8 & 9 would need to be filled in where there are zeros. The 24 grids all 'collapse' to only 4 unique patterns, with 8, 8, 4, and 4 reflection/rotational equivalents each.
Most of these arrangements are broken, however, as you cannot place exactly one 8 and one 9 in each box, column, and row without clashes. The exceptions are grids 3, 7, 19 and 20 (which are rotations of one another). Those four are therefore the only possible solutions to sudokus with 7 queens, disregarding transposition (i.e., substituting a different permutation of digits for 1-9).
The other 20 arrangements are still useful, however, as they can be used as the basis for puzzles with 6, 5 or fewer queens.
Grid 1. (broken)
123|450|670
407|613|052
@pgblu
pgblu / parity_groups.rb
Last active June 10, 2020 19:22
All possibilities for fulfilling any Parity Party clue
digits = (1..9).to_a
evens, odds = [0,1].map {|num| digits.select{ |k| k % 2 == num}}
def all_subsets(ar)
result = []
0.upto(ar.length) do |num|
result += ar.combination(num).to_a
end
result
end
# Usage: ruby commit-prepender this is my commit message without quotation marks
branch_name = %x.git rev-parse --abbrev-ref HEAD.
regex = Regexp.new(/[A-Z]*-[0-9]*/)
string_to_prepend = branch_name.match(regex).to_s
cmd = "git commit -m \"[#{string_to_prepend}] #{ARGV.join(" ")}\""
`#{cmd} >&2`
@pgblu
pgblu / bardens_tool.rb
Last active August 4, 2023 13:14
Barden's tool
dictionary = IO.readlines("path/to/your/dictionary").map {|word| word.chomp}
# you can replace "path/to/your/dictionary" with "/usr/share/dict/words", but I
# recommend a smaller dictionary, such as the one I've saved here:
# https://github.com/pgblu/dryphtwords/blob/master/app/fixtures/main_dictionary.txt
needed_length = ARGV[0].to_i
dropped_letter = ARGV[1]
let color1 = Math.round(Math.random() * 0xFFFFFF);
let fill1 = '#' + color1.toString(16).padStart(6,'0');
@pgblu
pgblu / README.md
Last active December 17, 2018 19:11
gray code viewer

Beckett-Gray sequences

viz. https://arxiv.org/pdf/1608.06001.pdf for a definition and discussion. The authors of the linked article were kind enough to provide me with the sequences.

@pgblu
pgblu / mobile_menu.js
Last active August 27, 2015 18:08 — forked from AlexaWebhead/mobile_menu.js
Css RWD mobile nav, triggered by JS
//mobile nav trigger
$('#menu-trigger').click(function (e){
e.preventDefault();
$('body').toggleClass('active');
$(this).toggleClass('active');
});
@pgblu
pgblu / README.md
Last active August 4, 2023 13:14
README for dryphtwords

dryphtwords

=============

A suite of tools that generate, validate, and serve examples of the Dryphtword game

How to play

This game takes a bit of getting used to.

@pgblu
pgblu / pomo function
Last active March 7, 2017 18:55
Command line timer with just-intonation pulse generator
# add this to your .bash_profile
# pomo() takes 0,1, or 3 arguments
# 1st is a time in minutes (default 25)
# 2nd and 3rd are a just-intonation ratio x:y (default 4:3)
# End the process with ctrl-C.
function pomo() {
case $# in
[0]*)
chuck ~/Documents/ChucK/pomo.ck