Skip to content

Instantly share code, notes, and snippets.

@twobob
twobob / create_captions.cmd
Created May 3, 2017 13:34
Create some text in a picture using imageMagick
Magick -size 240x240 -background transparent -font opendyslexic-regular-webfont.ttf -pointsize 18 ^
-fill black -gravity SouthWest caption:" baby, child, cute, daisy, face, family, fun, girl, happiness, human, little, one, outdoors, people, person, play, portrait, smile, toddler, young, youth " ^
-flatten ./IMG_3150.PNG
@twobob
twobob / checkOrient.py
Created May 3, 2017 14:32
pyhon snippet to check if a file is landscape or portrait with ImageMagick
import os, subprocess
subprocess.run(['Magick', './IMG_3160.jpg' ,'-identify' , '-format' ,'"%[fx:(w/h>1)?1:0]"','info:'], stdout=subprocess.PIPE).stdout.decode('utf-8')[-2]
@twobob
twobob / index.html
Created May 3, 2017 15:03
basic elasticlunr.js rework of the example page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Kaycare KI, lightweight full-text image tag search engine.</title>
<meta name="description" content="Kaycare KI for searching images" />
<meta name="keywords" content="Kaycare KI" />
<meta name="author" content="Kaycare" />
<meta name="google-site-verification" content="wibble-wobble" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@twobob
twobob / app.js
Created May 3, 2017 15:38
reworked elasticlunr.js demo page (to NOT used stored example_index.json) with incremental result rendering
requirejs.config({waitSeconds:0});
require([
'./jquery.js',
'./handlebars.js',
'./elasticlunr.js',
'text!templates/question_view.mustache',
'text!templates/question_list.mustache',
'text!templates/word_list.mustache',
'text!data.json'
], function (_, Mustache, elasticlunr, questionView, questionList, wordList, data, indexDump) {
@twobob
twobob / word_list.mustace
Created May 3, 2017 15:42
a simple word list generator template for mustace, use with the app.js for elasticlunr.js
<div>
<ul style="margin-left: 0px; margin-right: 0px; padding-left: 0px;">
{{#list}}
<a style="cursor:pointer" onclick="searchTerm('{{{x}}}')" class="listThing" >{{{x}}}</a>,
{{/list}}
</ul>
</div>
@twobob
twobob / question_list.mustace
Created May 3, 2017 15:44
a simple image/links template for mustace, use with the app.js for elasticlunr.js - supports proper comma placement
<div>
<ul style="margin-left: 0px; margin-right: 0px; padding-left: 0px;">
{{#questions}}
<li data-question-id="{{id}}">
<h2 style="padding-bottom: 10px;" ><a href="#">{{title}}</a></h2>
<img style="float:left; margin-right: 10px;" class="resizable_img" src="./img/thumbs/{{{thumb}}}" width="120" height="120" ></img>
<p style="min-height: 100px;">{{#each tags}}{{{this}}}{{#unless @last}}, {{/unless}}{{/each}}</p>
</li>
{{/questions}}
</ul>
@twobob
twobob / question_view.mustace
Created May 3, 2017 15:45
a simple SINGLE image/links template for mustace, use with the app.js for elasticlunr.js - supports proper comma placement
<div class="img_container">
<img class="resizable_img NOTelevate" style="cursor:help" src="./img/thumbs/{{{thumb}}}" width="480" height="480" title="{{{body}}}" alt="LOADING IMAGE, WAIT ONE MOMENT PLEASE" /></div><h2 style="padding-top: 5px; line-height:20px; margin-bottom:-10px"><strong>{{img}}</strong></h2>
<p style="min-height: 100px; line-height:15px;"><small>{{#each tags}}
{{{this}}}{{#unless @last}}, {{/unless}}
{{/each}}</small></p>
@twobob
twobob / makeOverlay.png.cmd
Created May 4, 2017 12:20
For creating text into pngs from the command line
Magick -size 1240x1240 -background transparent -font opendyslexic-regular-webfont.ttf
-pointsize 36 -fill black -gravity SouthWest caption:" face, family, fun," -flatten ./TEXT.PNG
@twobob
twobob / web-servers.md
Created May 12, 2017 03:32 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@twobob
twobob / clearEXIF.cmd
Created May 28, 2017 01:36
utterly remove exif with exiftool window command line
forfiles /m *.JPG /C "cmd /c echo 'Processing @file' & exiftool.exe -r -overwrite_original -P -all= @file"