Skip to content

Instantly share code, notes, and snippets.

David Tudury dtudury

Block or report user

Report or block dtudury

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dtudury
dtudury / queens.js
Created Jul 3, 2019
solution to eight queens puzzle
View queens.js
function place (placed, unplaced) {
if (!unplaced.length) return [placed]
let validPlacements = []
unplaced.forEach(unplacedRow => {
if (placed.every((placedRow, i) => {
const d = placed.length - i
return placedRow + d !== unplacedRow && placedRow - d !== unplacedRow
})) {
let possibleUnplaced = unplaced.filter(row => row !== unplacedRow)
validPlacements = [...validPlacements, ...place([...placed, unplacedRow], possibleUnplaced)]
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@dtudury
dtudury / hues.lum.js
Created Oct 17, 2016
map color hues to same luminance
View hues.lum.js
let lum = ([r, g, b]) => r * 0.2126 + g * 0.7152 + b * 0.0722;
let blend = (c0, c1, s, i = 1 - s) => [c0[0] * s + c1[0] * i, c0[1] * s + c1[1] * i, c0[2] * s + c1[2] * i];
let hex = c => c.reduce((p, v) => p + Math.round(0x100 + v * 0xff).toString(16).substr(-2), "");
let colors = {
red: [1, 0, 0],
yellow: [1, 1, 0],
green: [0, 1, 0],
cyan: [0, 1, 1],
blue: [0, 0, 1],
@dtudury
dtudury / emscripten_transcripten.md
Created May 5, 2016
emscripten notes and direction from Julian for Cosmin
View emscripten_transcripten.md

get the repo and tools

I've run this so it should be mostly (hopefully) okay

  • setup emscripten (I think you already have)
  • install sox; if you use homebrew: brew install sox
  • get Julian's WIP: git clone git@github.com:Voxer/voxer2mp3.git and git checkout jg-emscripten
  • do the magic:
    • ./buildvoxencode.sh
      • jgautier: "so you have a VoxEncode.js file now?"
View keybase.md

Keybase proof

I hereby claim:

  • I am dtudury on github.
  • I am dtudury (https://keybase.io/dtudury) on keybase.
  • I have a public key whose fingerprint is BF35 8F92 0C77 AD10 5A80 62D7 577E AC54 B305 E554

To claim this, I am signing this object:

View run_in_panes.scpt
#!/usr/bin/osascript
-- run as something like `./run_in_panes.scpt "echo a" "echo b"`
on run argv
set numCmds to count of argv
set numCols to round numCmds ^ 0.5 rounding up
set numRows to round numCmds / numCols rounding up
launch "iTerm"
View liquid.sugar.md

##Liquid Sugar: combine

  • 4 cups white sugar
  • 1 1/2 cups water
  • 1/4 teaspoon cream of tartar

in a covered pot over low heat for at least 30 minutes; makes 4 cups

because 4 cups contains 4 cups of sugar it's a very good substitute for granulated sugar. Boiling it with the cream or tartar inverts some of the sucrose creating a sweeter combination of sugars less prone to crystallization. The higher sugar content also increases the shelf-life.

View page2.js
/*
javascript:(function () {
var jsCode = document.createElement('script');
jsCode.setAttribute('src', 'https://rawgit.com/dtudury/9501738/raw/f383c0de610467b8b81d38b263772bb663b04ceb/page2.js');
document.body.appendChild(jsCode);
}());
*/
var numbers = "0123456789";
function randomNumber() {
return numbers.charAt(Math.floor(Math.random() * numbers.length));
View page1.js
/*
javascript:(function () {
var jsCode = document.createElement('script');
jsCode.setAttribute('src', 'https://rawgit.com/dtudury/9501081/raw/881aa3218effc7c8d108b5537fe18e427b246e98/page1.js');
document.body.appendChild(jsCode);
}());
*/
var numbers = "0123456789";
function randomNumber() {
return numbers.charAt(Math.floor(Math.random() * numbers.length));
@dtudury
dtudury / gist:7104972
Created Oct 22, 2013
arithmatic notes
View gist:7104972
  • augend + addend = sum
  • minuend - subtrahend = difference
  • multiplicand * multiplier = product
  • dividend / divisor = quotient
  • dividend % divisor = remainder
  • base ^ exponent = power
  • degree √ radicand = root
  • log ? base ? power = exponent
You can’t perform that action at this time.