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
import sys | |
import os | |
from PIL import Image, ImageDraw | |
def find_vertical_lines_by_gradient(image_path, gradient_threshold=10, min_width=1, max_width=7): | |
""" | |
Find vertical lines by detecting strong contrast changes in the middle row, scanning from center to left. | |
Returns a list of center X positions for each detected line. | |
min_width and max_width now refer to the actual pixel width of the detected line. |
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
# Grouping pictures into folder by count (6 in this case) | |
counter=0; group_number=1; for img in *.jpg; do [[ -e "$img" ]] || continue; if (( counter % 6 == 0 )); then mkdir -p "group_$group_number"; ((group_number++)); fi; mv "$img" "group_$((group_number-1))"; ((counter++)); done |
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
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import sys | |
import os | |
import argparse | |
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "true" | |
def generate_histogram(image_path, num_bins, y_scale, percentile, x_min, x_max): |
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
const extractSubNodeModules = async function*( | |
dir: string, | |
): AsyncGenerator<string, void, void> { | |
const files = await readdir(dir); | |
for (let i = 0; i < files.length; i++) { | |
const filepath = join(dir, files[i]); | |
const stats = await stat(filepath); | |
if (stats.isDirectory()) { | |
if (files[i] === 'node_modules') { |
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
#include <Bounce2.h> | |
#include <FastLED.h> | |
#define BRIGHTNESS_PIN A6 | |
#define NUM_LEDS 15 | |
#define DATA_PIN 7 | |
#define BUTTON_PIN 8 | |
#define COLUMNS 6 | |
#define ROWS 6 |
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
<link rel="import" href="../topeka-elements/category-images.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../core-icons/av-icons.html"> | |
<link rel="import" href="../paper-fab/paper-fab.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> |
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
class Node | |
constructor: (@data, @prev, @next) -> | |
@prev.next = this if @prev | |
@next.prev = this if @next | |
class LoopyBuffer | |
_head: null | |
_tail: null | |
_cursor: 0 | |
size: 0 |
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
_ = require 'underscore' | |
class BlackMagic | |
dp: null | |
dpMax: null | |
maxTotalWeight: 0 | |
minTotalWeight: 0 | |
minWeight: Number.MAX_VALUE |
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
#global portviz:false, _:false | |
# | |
# * 0-1 knapsack solution, recursive, memoized, approximate. | |
# * | |
# * credits: | |
# * | |
# * the Go implementation here: | |
# * http://rosettacode.org/mw/index.php?title=Knapsack_problem/0-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
// Generated on 2013-03-01 using generator-webapp 0.1.5 | |
'use strict'; | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var mountFolder = function (connect, dir) { | |
return connect.static(require('path').resolve(dir)); | |
}; | |
var pushStateHook = function (url) { | |
var path = require('path'); | |
var request = require('request'); // Need to be added into package.json |