Deriving a new Array from an existing Array:
['■','●','▲'].slice(1, 3) ⟼ ['●','▲']
['■','●','■'].filter(x => x==='■') ⟼ ['■','■']
['▲','●'].map(x => x+x) ⟼ ['▲▲','●●']
['▲','●'].flatMap(x => [x,x]) ⟼ ['▲','▲','●','●']
#!/bin/bash | |
# Locate the history file in your profile, and copy it to the same folder as this script. | |
# On Mac: ~/Library/Application\ Support/Google/Chrome/Default/History | |
# On Windows: C:\Users\YOUR USER NAME\AppData\Local\Google\Chrome\User Data\Default\History | |
sqlite3 History <<! | |
.headers on | |
.mode csv | |
.output out.csv |
alias rmdbc="find . -name *\ \(*conflicted* -exec rm {} \;" # recursively delete Dropbox conflicted files | |
# and/or (smart idea from Gordon Fontenot) | |
alias rmdbcsafe="find . -name *\ \(*conflicted* -exec mv {} ~/DropboxConflicts/ \;" # recursively move Dropbox conflicted files to temp folder | |
# or... via TJ Luoma | |
alias rmdbctrash="find . -name *\ \(*conflicted* -exec mv -v {} ~/.Trash/ \;" # recursively move Dropbox conflicted files to Trash | |
# More advanced idea combining ideas from @modernscientist and @GFontenot would be | |
# Hazel or launchd script to move conflicted files to temp folder once a day, and Hazel or launchd script to delete files older than [x] | |
# Or schedule TJ's idea of moving to Trash and skipping intermediate folder while still maintaining the ability to review | |
# hmmmm... |
#!/bin/sh | |
# script for optimizing images in a directory (recursive) | |
# pngcrush & jpegtran settings from: | |
# http://developer.yahoo.com/performance/rules.html#opt_images | |
# pngcrush | |
for png in `find $1 -iname "*.png"`; do | |
echo "crushing $png ..." | |
pngcrush -rem alla -reduce -brute "$png" temp.png |