-
-
Save Mikulas/b17c3e9cc963394818c0 to your computer and use it in GitHub Desktop.
OS X WaniKani wallpaper
This file contains 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
#!/usr/bin/env bash | |
DIR="/Users/mikulas/Dropbox/Images/Wallpapers/wanikani" | |
DAILY="$DIR/daily/$(date '+%Y%m%d').png" | |
if [[ -e "$DAILY" ]]; then | |
echo "Already generated today" | |
exit 1 | |
fi | |
wkwp | |
cp "$DIR/live/wp.png" "$DAILY" | |
killall Dock # force wallpaper reload |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>mikulas.wanikani.wallpaper</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/mikulas/bin/wkwp-daily</string> | |
</array> | |
<key>StartInterval</key> | |
<integer>3600</integer> | |
</dict> | |
</plist> |
This file contains 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
#!/usr/bin/env ruby | |
# brew install imagemagick --with-pango | |
# gem install wanikani | |
require 'wanikani' | |
Wanikani.api_key = 'YOUR_WANIKANI_API_KEY' | |
wanikani_kanji_data = Wanikani::Level.kanji(*(1..60)) | |
def color_for(item) | |
case (item['user_specific'] || {})['srs'] | |
when 'apprentice' then '#dd0093' | |
when 'guru' then '#882d9e' | |
when 'master' then '#294ddb' | |
when 'enlighten' then '#0093dd' | |
when 'burned' then '#000000' | |
else '#c5c5c5' | |
end | |
end | |
kanji = wanikani_kanji_data.sort_by{|x| x['character']}.rotate.map{|x| "<span font_family=\"meiryo\" foreground=\"#{color_for(x)}\">#{x['character']}</span>"} | |
%x{convert -background white \ | |
-border 90 \ | |
-bordercolor white \ | |
-size 2700x1620 \ | |
-font meiryo \ | |
-pointsize 37 \ | |
pango:'#{kanji.join}' \ | |
~/Dropbox/Images/Wallpapers/wanikani/live/wp.png} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment