Skip to content

Instantly share code, notes, and snippets.

--2011-06-10
--http://organognosi.blogspot.com/
tell application "Skim"
set the clipboard to ""
set numberOfPages to count pages of document 1
activate
set myColorCodes to my chooseColor()
display dialog "Do you want to export all the notes or some of them?" buttons {"All", "Some"} default button 1
set answer to button returned of the result
@loochao
loochao / org-export-to-devonthink.el
Created November 5, 2016 14:23
org-export-to-devonthink
(defun org-export-to-devonthink (arg)
"Call `org-export-to-devonthink` with output to a temporary buffer.
No file is created."
(interactive "P")
(let (content)
(org-export-as-html arg nil nil "*Org HTML Export*")
(switch-to-buffer "*Org HTML Export*")
(setq content (buffer-string))
(kill-buffer "*Org HTML Export*")
(setq content (replace-regexp-in-string (regexp-quote "\"") "\\\"" content t t))
@loochao
loochao / smtpmail-gmail.el
Created November 6, 2016 14:17
smtpmail-gmail
(use-package smtpmail
:config
(setq message-send-mail-ggfunction 'smtpmail-send-it
smtpmail-stream-type 'starttls
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587
send-mail-function 'smtpmail-send-it))
@loochao
loochao / ASCII Art.txt
Created November 13, 2016 02:00
ASCII Art
_______________________________________________________
| |
/ | Apps by Chris |
/---, | Quality Retail MAS Apps for Mac |
-----# ==| | Requests: [email protected] |
| :) # ==| | |
-----'----# | |______________________________________________________|
|)___() '# |______====____ \___________________________________|
[_/,-,\"--"------ //,-, ,-,\\\ |/ //,-, ,-, ,-,\\ __#
( 0 )|===******||( 0 )( 0 )||- o '( 0 )( 0 )( 0 )||
@loochao
loochao / idx-lib-touch.sh
Last active November 21, 2016 20:49
copy a directory structure with file names without content
# generate 0-byte sub
find src/ -type d -exec mkdir -p dest/{} \; \
-o -type f -exec touch dest/{} \;
# generate index, name only
# http://stackoverflow.com/questions/9102313/rsync-to-get-a-list-of-only-file-names
# x-devonthink-item://17E800D2-CEF3-46BB-8828-872C51C05698
# idea: make a new empty folder, run rsync --dry-run(-n) recursively(-r)
# grep -v '.git' excludes .git files
# grep -Ev '.git|.DS_Store' excludes both .DS_Store and .git, -E is a must
line=$(wc -l $fullname | awk '{ print $1; }');
echo $line
#!/usr/texbin/perl
use strict;
use warnings;
my $ROOT = "/Volumes/DATA/Dropbox/Research/Papers2/"; # dir holding data files
#my $ROOT = "$ENV{HOME}/Downloads/Test/SRC"; # dir holding data files
my $META = "$ENV{HOME}/Downloads/Test/DEST"; # dir holding meta files
my %FILE_TO_DATE = file_hash( $ROOT );
@loochao
loochao / idx.sh
Last active November 21, 2016 22:34
index LIBNS files, filter some, package index files to a tar
!/bin/bash
ROOT=/volume1/LIBNS/
for i in $(ls $ROOT |grep -Ev '@eaDir|_libman|LIBRARY' |grep '.*'|grep WORK); do
echo $i
TMP_DIR=`mktemp -d /tmp/rsync.XXXXXX`
IDX_DIR=${ROOT}${i}"/"
echo $IDX_DIR
rsync -nr --out-format='%n' $IDX_DIR $TMP_DIR | grep -Ev '@SynoResource|@eaDir|.git|.DS_Store|Mao|Aaron' > "${i}_`date +%F`".txt
rmdir $TMP_DIR
done
@loochao
loochao / idx_split.sh
Created November 21, 2016 21:48
Split big library index files (txt format) into smaller ones (10000 lines per file)
archive="../_lib.idx_achive/"
if [ ! -d $archive ]; then
mkdir $archive
fi
for i in `ls`; do
if [ $i != $0 -a ! -d $i ]; then
fullname=$i;
name=${i%.*};
if [ ! -d $name ]; then
@loochao
loochao / taggable.java
Created November 24, 2016 15:32 — forked from tonyseek/taggable.java
"Mixin" is a kind of composite pattern implementation.
import java.util.List;
import java.util.ArrayList;
interface Entity {
public int getId();
public int getKind();
}
interface Taggable {
public void addTag(int tagId);