Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages and install them manually as needed.
| import Text.Printf (printf) | |
| ----------------------------------------------------------------------------------------- | |
| {-| Datatype for all the objects -} | |
| data Object t = | |
| Object { getA :: Int -- common fields for all the objects | |
| , setA :: Int -> Object t -- setter example | |
| , action1 :: IO () -- generally speaking, action is just a regular object field | |
| , objectType :: t | |
| } |
| // from: | |
| // http://stackoverflow.com/a/2490876 | |
| // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent | |
| // prototype.js | |
| // https://gist.github.com/heyi/a76167229038b4718a50 | |
| // and etc | |
| (function(){ | |
| var sendEvent = document.createEvent ? function(name, target) { | |
| /* WARNING: |
| ////////////////// | |
| ////ATTACH EVENT LISTENER | |
| ///////////////// | |
| function attachEventListener(eventTarget, eventType, eventHandler) { | |
| if (eventTarget.addEventListener) { | |
| eventTarget.addEventListener(eventType, eventHandler, false); | |
| } else if (eventTarget.attachEvent) { | |
| eventType = "on" + eventType; | |
| eventTarget.attachEvent(eventType, eventHandler); | |
| } else { |
| #!/bin/sh | |
| # This program has two feature. | |
| # | |
| # 1. Create a disk image on RAM. | |
| # 2. Mount that disk image. | |
| # | |
| # Usage: | |
| # $0 <dir> <size> | |
| # |
| #!/usr/bin/env bash | |
| size=1024 # MB | |
| mount_point=$HOME/tmp | |
| name=$(basename "$mount_point") | |
| usage() { | |
| echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \ | |
| "(default: mount)" >&2 | |
| } |
| if application "Google Chrome" is running then | |
| tell application "Google Chrome" to make new window with properties {mode:"incognito"} | |
| else | |
| do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito" | |
| end if | |
| tell application "Google Chrome" to activate |
| on is_running(appName) | |
| tell application "System Events" to (name of processes) contains appName | |
| end is_running | |
| set chrome_running to is_running("Google Chrome") | |
| if chrome_running then | |
| tell application "Google Chrome" | |
| repeat with w in (windows) | |
| if mode of w is "incognito" then | |
| set index of w to 1 |
| #!/bin/bash | |
| # convert DjVu -> PDF | |
| # usage: djvu2pdf.sh <file.djvu> | |
| # depends on ddjvulibre package, To install package run `sudo apt-get install ddjvulibre` | |
| i="$1" | |
| echo "------------ converting $i to PDF ----------------"; | |
| o="`basename $i .djvu`" | |
| o="$o".pdf |
Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages and install them manually as needed.
| if [ $# -ne 1 ]; then | |
| echo "Usage: make-icns icon.png" | |
| exit 1 | |
| fi | |
| IMAGE=$1 | |
| OUT=`basename ${IMAGE%\.*}`.iconset | |
| mkdir $OUT | |
| sizes=(16 32 128 256 512) |