My Firefox won't paste text! A workaround using AutoHotkey.

In Firefox I often find myself unable to paste into Facebook or YouTube comment boxes. I've been a Mozilla fan since 3.0, but bugs like these make Firefox a pain. Here's a workaround that works in my 64-bit Windows 7:
  1. Install AutoHotkey.
  2. Save this script as "type_clipboard.ahk":
    ; http://www.autohotkey.com/board/topic/76296-type-out-text-in-clipboard/
    ; ctrl+win+v
        sendraw %clipboard%
  3. Run the script and press Ctrl+Win+V to have AutoHotkey type your clipboard text into Firefox.



The dress is Coffee and Cool grey according to my new script:

What's that color?

Try these context-dependent colors: rgb(113,94,58) and rgb(135,154,189)



Cyrillic to Latin

Tired of unreadable Russian characters? Try this JavaScript:
var Cyrillic_Latin = {
 "А":"A", "а":"a",
 "Б":"B", "б":"b",
 "В":"V", "в":"v",
 "Г":"G", "г":"ɡ",
 "Д":"D", "д":"d",
 "Е":"Je", "е":"e",
 "Ё":"Jo", "ё":"jo",
 "Ж":"S", "ж":"s",
 "З":"Z", "з":"z",
 "И":"I", "и":"i",
 "Й":"J", "й":"j",
 "К":"K", "к":"k",
 "Л":"L", "л":"l",
 "М":"M", "м":"m",
 "Н":"N", "н":"n",
 "О":"O", "о":"o",
 "П":"P", "п":"p",
 "Р":"R", "р":"r",
 "С":"S", "с":"s",
 "Т":"T", "т":"t",
 "У":"U", "у":"u",
 "Ф":"F", "ф":"f",
 "Х":"X", "х":"x",
 "Ц":"Ts", "ц":"ts",
 "Ч":"Tj", "ч":"tj",
 "Ш":"Sh", "ш":"sh",
 "Щ":"Sh", "щ":"sh",
 "Ъ":"", "ъ":"",
 "Ы":"E", "ы":"e",
 "Ь":"ʲ", "ь":"ʲ",
 "Э":"E", "э":"e",
 "Ю":"Ju", "ю":"ju",
 "Я":"Ja", "я":"ja",
 "І":"I", "і":"i",
 "Ѳ":"F", "ѳ":"f",
 "Ѣ":"E", "ѣ":"e",
 "Ѵ":"I", "ѵ":"i",
 "Ѕ":"Z", "ѕ":"z",
 "Ѯ":"Ks", "ѯ":"ks",
 "Ѱ":"Ps", "ѱ":"ps",
 "Ѡ":"O", "ѡ":"o",
 "Ѫ":"Ju", "ѫ":"ju",
 "Ѧ":"Ja", "ѧ":"ja",
 "Ѭ":"Ju", "ѭ":"ju",
 "Ѩ":"Ja", "ѩ":"ja"

function Cyr2Lat(text){
 var out = ""
 for(i in text) out += Cyrillic_Latin[text[i]] || text[i]
 return out

Here it is as a bookmarklet that converts the current page (thanks to this snippet):

javascript:(function(){function t(t){var n="";for(var i in t)n+=e[t[i]]||t[i];return n}function n(e){if(e.nodeType==3&&e.nodeValue.trim()!=""){e.nodeValue=t(e.nodeValue)}else{for(var i=e.childNodes.length-1;i>=0;--i){n(e.childNodes[i])}}}var e={"А":"A","а":"a","Б":"B","б":"b","В":"V","в":"v","Г":"G","г":"ɡ","Д":"D","д":"d","Е":"Je","е":"e","Ё":"Jo","ё":"jo","Ж":"S","ж":"s","З":"Z","з":"z","И":"I","и":"i","Й":"J","й":"j","К":"K","к":"k","Л":"L","л":"l","М":"M","м":"m","Н":"N","н":"n","О":"O","о":"o","П":"P","п":"p","Р":"R","р":"r","С":"S","с":"s","Т":"T","т":"t","У":"U","у":"u","Ф":"F","ф":"f","Х":"X","х":"x","Ц":"Ts","ц":"ts","Ч":"Tj","ч":"tj","Ш":"Sh","ш":"sh","Щ":"Sh","щ":"sh","Ъ":"","ъ":"","Ы":"E","ы":"e","Ь":"ʲ","ь":"ʲ","Э":"E","э":"e","Ю":"Ju","ю":"ju","Я":"Ja","я":"ja","І":"I","і":"i","Ѳ":"F","ѳ":"f","Ѣ":"E","ѣ":"e","Ѵ":"I","ѵ":"i","Ѕ":"Z","ѕ":"z","Ѯ":"Ks","ѯ":"ks","Ѱ":"Ps","ѱ":"ps","Ѡ":"O","ѡ":"o","Ѫ":"Ju","ѫ":"ju","Ѧ":"Ja","ѧ":"ja","Ѭ":"Ju","ѭ":"ju","Ѩ":"Ja","ѩ":"ja"};n(document)})()


Useful comments

While the comments in my Assembly post were useful to beginners, experts who can read the code might find them annoying. Here's an example of helpful comments for experienced programmers:

function delete_month(id, index){
 $(".row[id^="+id+"] .cell:nth-child("+(index+1)+")").each(function(i,e){
  if(i==0 && e.className.indexOf("draggable")<0) return  // only change sandbox budget.
   this.style.left = (parseInt(this.style.left)-mw)+"px"
   cellBlur(this)  // update availability
  $(this).prevAll().addClass("changed")  // needed in case there is no next cell.
 //updateTotals()  // too slow here
 btnSave.value = "Save*"
Note that i'm describing WHY the code is there, not HOW it works (which should be obvious to any decent JavaScript coder, who also should have an editor capable of wrapping lines to their preferred width).


How to freeze a Google Chrome tab

Chrome cares more about speed than user interaction. This simple bug just hung my tab while hogging one CPU core:
function isOverflowed(element){
    return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;

function resize_to_fit(el){
 var size = parseFloat(el.style.fontSize) || 55
 log("resizing from " + size)
 while(isOverflowed(el) && size > 8){
  el.style.fontSize = size - 1
Press Shift+Escape, sort by CPU descending, and end the offending process to recover. Still better than Firefox.

This is what i meant to write, to resize text content to fit an HTML element like a div:
function isOverflowed(element){
 return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth

function resizeToFit(el){
 var size = parseFloat(el.style.fontSize) || 55
 while(isOverflowed(el) && size > 8){
  size -= 1
  el.style.fontSize = size + "px"


How to manually mount a USB storage device in GNU/Linux

After creating a bootable (possibly smaller than 16 GB for BIOS compatibility) USB stick, using Universal USB Installer or equivalent, you may find that some distros, like System Rescue CD do not automount your other/larger USB storage devices.

To solve that, run these commands from your terminal:
mkdir stick
fdisk -l
mount /dev/sdc1 stick
That will:

1. create a mountpoint
2. allow you to find the device that matches your storage size, e.g. /dev/sdc
3. mount the 1st partition of that device on your mountpoint

Before removing the device you may want to unmount it, lest OSs like Windows complain on insert:
umount stick
You can possibly save keystrokes by pressing the up arrow key a few times so you only have to prepend a "u" to the mount command in your command history:
umount /dev/sdc1 stick


Learn how to program in Assembly code in 2 minutes using debug!

A computer is a calculator with more features and commands to use them.

To program it (tell it what to do) at the lowest human-readable level (one step above the zeroes and ones of binary), you can use Assembly code, as shown here:

A neater, yet perhaps slightly more complex version of "Hello World" in Assembly can be found here. Annotated version:
A                  ; enter assembly mode
MOV AH,9           ; set High byte of Accumulator register to display a string of text terminated by the '$' character
MOV DX,108         ; set Data register to the location of the string to display
INT 21             ; execute an I/O function set in AH register
RET                ; return
DB 'HELLO WORLD$'  ; store a string

R CX               ; set Counter register (switches from 16-bit mode to 32-bit mode on a 80386 CPU or better)
14                 ; current code position in hexadecimal to specify program length (14 is 20 in decimal)
N MYHELLO.COM      ; name your command file
W                  ; write the program to the file
Q                  ; quit debug
Sadly, Windows 2003 was the last OS that shipped with the debug command. There are other assemblers and operating systems that are free and actively supported. This tutorial site appears to focus on the NASM assembler on Linux.

Simple assembly code runs very fast (640x200 video on a 4.77MHz 8088 IBM PC Model 5150 with 640K RAM, SoundBlaster, and 20 MB HDD), but takes a lot of work to write, and each system tends to have different opcodes, so programmers in the 1970s invented and largely moved to more abstract, higher level languages like C. In the 1990s, another such step occurred, to Java, the most business-like among new '90s languages. Lately, though, since the 2000s, high-level scripting languages like Python have become more popular among people tired of typing a lot, for code that may run milliseconds slower, depending on flavor. Remember: First get it right, then make it fast.