Skip to content

Instantly share code, notes, and snippets.

@yenliangl
yenliangl / fontconfig.properties
Created July 23, 2012 04:24
Java's fontconfig.properties file for Windows 7
# %W% %E%
#
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Version
version=1
# Component Font Mappings
@yenliangl
yenliangl / flac2alac.bash
Created March 12, 2012 05:39
Convert flac to Alac (Apple Lossless Audio Codec)
# convert flac files in current directory to Apple loss-less codec.
function flac2alac {
for f in *.flac; do
ffmpeg -i "$f" -acodec alac "${f%.flac}.m4a"
#-map_meta_data $f:${f%.flac}.m4a;
done
}
@yenliangl
yenliangl / TimePickerWithKeyboard.xml
Created January 6, 2012 12:59
TimePicker/DatePicker with keyboard problem
<TimePicker android:id="@+id/time_picker"
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:addStatesFromChildren="true"/>
android:layout_height="wrap_content"/>
@yenliangl
yenliangl / open.sch
Created January 6, 2012 12:14
Mimic MacOSX 'open' command in Unbuntu and Windows
alias open='gnome-open' # in Ubuntu
alias open='cygstart' # in Windows/Cygwin
@yenliangl
yenliangl / my-org-publish.el
Created January 5, 2012 08:21
Publish org to remote host via SSH
(require 'org-publish)
(setq org-directory "~/Dropbox/Org")
(setq org-internal-directory "~/Org")
(setq org-internal-publishing-directory (concat "/ssh:" user-login-name "@HOST01:~/public_html"))
(setq org-publish-project-alist
`( ;use back-quote
;; publish to public cloud
("org" :components ("org-notes" "org-static" "org-ebooks"))
;; publish to internal cloud
@yenliangl
yenliangl / create_dedicated_emacs_server_for_each_screen.csh
Created January 5, 2012 08:10
Get Emacs workspace for each GNU screen
setenv DEFAULT_WORKSPACE "default"
if ( $?WORKSPACE == 0 ) then
setenv WORKSPACE $DEFAULT_WORKSPACE
endif
# Define alias 'et' to connect to the proper Emacs server identified by EMACS_SEVER_NAME
setenv EDITOR "emacsclient -s $WORKSPACE -t -a ''"
alias et "$EDITOR"
# Create alias 'kill-emacs' to kill proper Emacs server.
@yenliangl
yenliangl / customize-compile.el
Created January 5, 2012 07:59
Customize compile command in Emacs
(define-key c++-mode-map [(f8)] 'my-make-compile-command)
(define-key c++-mode-map [(f9)] 'my-make-g-compile-command)
(defun my-make-compile-command ()
(interactive)
(set (make-local-variable 'compile-command)
(concat "make -C " default-directory))
;; (setq current-prefix-arg '(4)) ;C-u
(call-interactively 'compile))
@yenliangl
yenliangl / emacsclient.c.diff
Created December 27, 2011 13:44
Patch for emacsclient-23.3b
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 6b7c7c3..c6df02d 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1479,7 +1479,7 @@ w32_give_focus ()
/* Start the emacs daemon and try to connect to it. */
void
-start_daemon_and_retry_set_socket (void)
+start_daemon_and_retry_set_socket (char* sname)
@yenliangl
yenliangl / gist:1437500
Created December 6, 2011 09:14
Check SD card state
Environment.getExternalStorageState()
@yenliangl
yenliangl / gist:1437498
Created December 6, 2011 09:14
Detecting WiFi
private static boolean isConnected(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = null;
if (connectivityManager != null) {