Showing posts from April 15, 2012

CSS3 box shadows fun

“inset” box shadow makes the shadow go inside the box. All other parameters are the same. Here's a example. inset shadow Here's the CSS code:div { width:100px;height:60px; padding:1ex; border:solid thin blue; box-shadow: inset 3px 3px red } Inset Shadow Example 2 inset shadow div {width:100px;height:60px; padding:1ex; box-shadow: inset 0px 0px 20px 5px red} multiple Shadow with Inset in/out shadow div { width:100px;height:60px; padding:1ex; box-shadow: inset 0px 0px 4px 3px red, 0px 0px 4px 3px red; } Multiple Box Shadowsmulti box lunch

Here's the CSS code:div { display:table; border-radius:9px; padding:0.5ex; margin:5ex; box-shadow: 8px 6px 13px 8px hsl(1, 100%, 50%), -16px 12px 20px 16px hsl(60, 100%, 50%), 48px 36px 71px 28px hsl(180, 100%, 50%); } more examples at

Emacs: Stop Yasnippet auto-indent

one thing that's been annoying me for years. Yasnippet indent your lines when you don't want to. Especially when you specifically didn't include any indentation hint in the template. Have been trying to find a special syntax in template to stop the auto-indent behavior, never found it or didn't spend enough time.found a solution today: (setq yas/indent-line nil)

CSS Boxshadow rainbow

bleeding rainbow

div { display:table; padding:0.5ex; margin:5ex; box-shadow: 8px 6px 3px 8px hsl(30, 100%, 50%), 16px 12px 6px 16px hsl(60, 100%, 50%), 24px 18px 9px 24px hsl(90, 100%, 50%), 32px 24px 12px 32px hsl(120, 100%, 50%), 40px 30px 15px 40px hsl(150, 100%, 50%), 48px 36px 18px 48px hsl(180, 100%, 50%), 56px 42px 21px 56px hsl(210, 100%, 50%), 64px 48px 24px 64px hsl(240, 100%, 50%), 72px 54px 27px 72px hsl(270, 100%, 50%), 80px 60px 30px 80px hsl(300, 100%, 50%), 88px 66px 33px 88px hsl(330, 100%, 50%), 96px 72px 36px 96px hsl(360, 100%, 50%); }detail at

CSS round corners

another article on CSS: CSS: Round Corners: border-radius

CSS color names, HSL, Opacity

Why Tiling Window Manager Sucks

Perm URL with updates: xmonad today for real. Currently, 1 hour into it. 〔☛ How to Use xmonad; xmonad Keys〕Tiling windows is unusable and inefficient.• Complete esoteric set of keys you need to memorize just for the tiling-window mechanism. Also, standard keys such as 【Alt+F4】 are now screwed.• More Combo keys = RSI. 〔☛ Keyboard Shortcut Design: Dedicated keys, Special Buttons, Extra Keys〕 I type more than any Haskell coder on this earth.• Encroach on each app's keys. This means, you'll spend time to config each app, or diddle with the global mod key setting. This means hours to be spent down the road.• Completely screwing emacs's keys. 〔☛ Emacs's Keybinding Layout〕 (No, remapping to any of Super, Hyper, Menu, Caps Lock keys won't help. All modifier keys are used up in my emacs for many purposes, including inserting math symbols.) Tiling Windows Concept = FailWorst of all, the tiling windows idea it…

How to Use xmonad; xmonad Keybinding

Perm URL with updates: page gives a intro on using xmonad. xmonad is a linux app that automatically arrange your windows without gaps. To install, see: Linux: How to Install New Windows Manager.When logging in, you may have a choice of {xmonad, xmonad-gnome}. The gnome one will have the screen menu at top and app menu at bottom.xmonad keyslaunching app• 【Alt+Shift+Enter】 to launch a terminal.• 【Alt+p】 to launch dmenu. e.g. 【Alt+p fir】 to launch Firefox.• “dmenu” is a GUI app for dynamic menu, designed for keyboard input. (this is independent of xmonad)Switch Focus• {【Alt+j】, 【Alt+k】} to move focus among windows. Or, hover mouse on a window.• {【Alt+Shift+j】, 【Alt+Shift+k】} swap neighboring windows.Arranging Window• 【Alt+Space】 to re-arrange windows. (by default, you can cycle among 3 types of arrangement: full screen, tall, wide.)Resize Window【Alt+l】 = make current window larger.【Alt+h】 = make current window smaller.Float Window【Alt+Click】 t…

Programing: Design Patterns Your Mom

Perm URL with updates: are the design patterns that help structure functional systems? “Design patterns? Hey everyone, look at the muggle try to get the wand to work!”from:Code Watch: Functional programming's smugness problem2012-04-16 By Larry O'brien. @ Source www.sdtimes.comhi, my dearly beloved javaperl python hackers, design patterns your mom.further readings:Why Software SuckWhat is ScientificAre You Intelligent Enough to Understand HTML5?Book Review: Patterns of SoftwareWhat is a Tech Geeker?

random linux notes 2012-04-18

Perm URL with updates:• discovered yum. (Yellowdog Updater, Modified) It's a package manager for Red Hat's RPM package system. The name YellowDog, is from a Mac linux distro in 1999. Yellow Dog Linux seems still around.• on Fedora linux, man {shutdown, halt, poweroff, reboot} says: “These are legacy commands available for compatibility only”. So, what is the modern command?Answer: there doesn't seem to be a standard among linuxes. (See “Replacement for init” at Init.) Fedora uses systemd.Note that in Ubuntu, the man page for “shutdown” is different, and doesn't come with such note.• discovered wmctrl. This seems to be linux's analog of AutoHotkey for Microsoft Windows. Basically, a scripting lang that lets you set keys. e.g. press F6 to launch Terminal, and if one is already running, just switch to it.unix stupidities checkhere's more food for my wrath. todo tomorrow.• check if linux ps still silently truncate…

Linux: How to Install New Windows Manager

Perm URL with updates: are the steps i need to do to switch a windows manager in linux?let's say i wanna try Xmonad. I can apt-get install xmonad. But what's next?• how do i start the new wm? (do i need to quit the existing? (i know ps kill pid and all that. But is there a better way?))• how do i set my config so when linux starts, it starts the new wm? (i really don't want end up with a fucked up startup)i know unix command line stuff well, but don't have any experience with linux GUI technology. what i need is a general experience/guide of switching wm. (and i hope it's not just spent few hours to dig in each's doc with raw sys admin skills. if this is how it is, please let me know too, i'll probably just stay with whatever default wm.)Answerin Fedora you yum install xmonad-gnome and then just log out and log in again. And in the login panel, there's a menu that lets you chose the Wind…

Emacs: kill-buffer Induces Buffer Accumulation

in my usage pattern, i find that one problem of emacs default UI is that it makes it difficult to close a buffer.kill-buffer 【Ctrl+xk】 then Enter, and if it's not saved, one has to type full yes or no. Too many keystrokes. Also, when it's scratch or buffer not associated with file, it doesn't ask for save.these make people not want to close buffer. So, buffer accumulates. Instead of close files we don't need, people use bury-buffer, switch-to-buffer, even though we just want to close it. Tens or hundreds of buffers became a problem, Then, kill-some-buffers, clean-buffer-list, iswitchb-mode, ido-mode, are invented to solve this new problem.By habit, i always close buffers that i'm done working with. I do that for the past decade, even if it means painfully using kill-buffer. So, usually i have no more than 20 buffers open. In past years, with ErgoEmacs Keybinding and my own AutoHotkey setup, i have single key to close buffer, and with just y/n if unsaved. This also …

Set Bash Shell Prompt to Color

Perm URL with updates:'s a neat setup for your bash shell. Put the following in your Bash init file 〔~/.bash_profile〕:exportPS1="\e[0;32m◆\u@\H \e[0;33m\D{%Y-%m-%d} \e[0;32m\t \e[0;37m\w\n"; The \e[0;32m in the beginning set the color green. The \e[0;37m near the end sets color back to black. (See: ANSI escape code.)It'll make your prompt color green and display login name, date, and time, like this:◆xah@xah-PC2012-04-1701:49:16~/.emacs.d/▮Date and time is useful because when you log your shell output.EmacsFor coloring bash prompt running inside emacs, put the following in your emacs init file. (setenv "PS1""\\e[0;32m◆\\u@\\H \\D{%Y-%m-%d} \\t\\e[0;30m\\w\\n")

Xah's Job Interview Questions for Young Linux Sys Admins

Perm URL with updates:• what's the diff between {.profile .bashrc .bash_profile .login}?• how to find the creation date of a file?• top shows load average n1 n2 n3. What are those numbers mean exactly?• how to eject a CD by command line?• what's the difference between ps aux, ps -aux, ps -ef?• what chars are not allowed in unix file name?• how to set sticky bit for a file?• how to create a hard link? how it differs from soft link?• how to list all the signals the system supports?• what does 【Ctrl+c】 do in a terminal? how do you find out arbitrary control sequence do?• how to show the number of inode you have?• what's the difference between useradd and adduser?• what's the difference between character special file and block special file?

random linux notes 2012-04

Perm URL with updates:'t done serious unix sys admin for about a decade. (serious = sys admin in server farm.)been playing with ubuntu for past days. Oh, su and chmod and w id whoami ps top fg bg nice mount passwd etc fdsk shit. The horrors of unix all came back.installed Oracle VM Virtualbox with guest OS Ubuntu and Fedora.Actually got to know Virtualbox for real, for first time.VirtualBox is so great. You can run several linux distros, and you can fuck unix. When they finally can't take anymore, kill! Start anew! Life's good.Ubuntu vs Fedora vs Linux MintFedora is from Red Hat. Linus uses it. Ubuntu is a distro specialized for dummies, but in many ways it's much smooth, but is still linux that you can change anything if you know what u doing. Fedora doesn't seem to be known for any specialized take. The top 3 most pop linux distro are: Linux Mint, Ubuntu, Fedora. (the main thrust of Linux Mint appears to bund…

Lisp: Check If a Item Exist in a List

wrote this yesterday, when i want to know if a item exists in a list. (defunsequence-to-alist (mySequence) "Take a sequence mySequence and returns a association list. Each element's cdr is “t”. Example: (sequence-to-alist (list 3 4 5)) ⇒ ((3 . t) (4 . t) (5 . t)) This function is useful when you need to check a element is in a list, using `assoc' without loading CL library." (mapcar (lambda (ξx) (cons ξx t) ) mySequence)) ends up not using it. But, i think even if i need it, i probably should just use whichever is in the CL package. Btw, of you Common Lisp coders, what function would it be?Answer: there's a elisp function member. (thanks to Elias Mårtenson.)

Keyboard Geeking: Backspace or Not Backspace? (Keys for Goto Previous Page in Windows and Linux)

in linux, the Backspace key is not used for goto previous page. e.g. in Google Chrome or Firefox. The keys are 【Alt+←】 and 【Ctrl+[】.On Windows, you can use ⌫ Backspace. And 【Shift+⌫ Backspace】 for forward. (Apple Mac also adopted this around 2006)Xah Analysis: the Windows key is superior. (Sorry tech geekers of the unix faction.)Reason:The Backspace is not as logical. It's like, WTF? Backspace is for deleting backward. Especially so when you are posting a comment. The 【Alt+‹left/right arrow›】 or 【Ctrl+‹square brackets›】 are more logical.But the Backspace is more convenient, ergonomic, because it is a single key, and a big key.The operation for “goto previous page” is one of the most needed key. Perhaps in top 5. (among {page up/down, goto file top/bottom, prev/next tab, close tab})For such frequently needed key, convenient/ergonomic has far more priority than logicality.Detail at: Keyboard Shortcut Design: Dedicated keys, Special Buttons, Extra KeysDesigning a Math Symbols Input S…

unix aspell's Dismal Vocabulary Size

Perm URL with updates: unix aspell is really bad. So many common words it doesn't know. Here's a list i've added. Add the following to the file 〔~/.aspell.en.pws〕. (the first line in the following file is special. Don't over-ride the first line in your file.) personal_ws-1.1 en 11 backtick meritable utopian programable employability downloadable thru heterogeneousness euphemized miscommunication login immersive fandom proselytization youngling microcephalic endianness pinky natively liers chantable screenshots lol blockquote exemplarily programer's programers neuroscientist lookup exposit hotkey blocky builtin ubiquitousness screenshot weblog programer subfolders superset datatype keybinding other's malware toruses polytope combinatorics incenter automata Calculational regex regex's Logitech ErgoEmacs FSF's Cygwin unix Solaris Googlers Erlang Mathematica Mathematica's OCaml Scala perl's JScript n…

array programing language: APL, Mathematica

APL and Mathematica can both be categorized into a so-called Array programming language. It basically means, when a operand is a array/list, the operation is automatically mapped into the list. (as opposed to using a explicit “map” in lisp, perl, python.).Here's APL implementation of normalizing a n-dimentional math vector. normalize←{⍵÷((+/⍵⋆2)⋆0.5)} Code by Tom Novelli. APL code can be run here: Source's Mathematica: normalize = Function[#/Sqrt@(Plus@@(#^2))] For detail, see: Vector Normalize Function in Mathematica, Haskell, Ruby, Python, Perl, Scheme Lisp, Javascript, Java, CHow to Create a APL or Math Symbols Keyboard Layout