Monday, January 7, 2013

I've been using Google Chrome developer tools for a while now, but today I decide to dig deeper.
 the dev tools home page links to a Google i/o video walking through the latest and greatest for dev tools.

My notes:
  • remote debugging (see the docs)
  • quick select for file (CTRL-O or CMD-O that's an oh not a zero)
    • somefile.js:400 will take you to line 400 on somefile.js
  • view functions defined in a file  (CTRL-SHIFT-O or CMD-SHIFT-O again that's an oh not a zero)
  • the ability to make changes in dev tools and have those changes reflected in source (see DevTools Autosave)
  • timeline snapshot frame mode can tell what is taking to long to give the sense of something being "slow".  A frame is the full amount of time the browser requires to render the HTML, do CSS selection, run JavaScript, etc. The baseline of 60 Hz, that's 60 frames per second or about 16ms per frame.
  • Not surprisingly, event listener memory leaks, are a point of concern.
    • you can use timeline to see your memory footprint grow, then use profiles to take heap snapshots.
    • shallow size- the size of the object itself
    • retained size- the total size of the object and everything it refrences
    • use 'Comparison' to compare between snapshots
  • $0 to explore the currently selected element-- this works on the Elements tab as well as the Snapshots  tab
  • source maps -- when compiling with the closure compiler have it generate a source map.  Then your page should include a link to the source map
  • when deleting nodes via the Elements tab, CTRL-Z will undo the delete, the re-created node will be the same as it was before so JavaScript code will still work
  • Chrome Canary is the daily updated Chrome.  It can be installed alongside stable chrome.




Wednesday, April 20, 2011

git clone fails when cloning from OSX

if you try to git clone a project where the remote host is osx you'll have issues. The problem is interactive shells get their path from /etc/paths + /etc/paths.d + /etc/bashrc + anything you put into your ~/.bash_profile (in my case I just soft link my .bash_profile to .bashrc so I dont go crazy switching back and forth between Linux and OSX).

Non-interactive shells do not get the paths from /etc/. So when cloning you'll get

bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly


This means ssh couldn't find git-upload-pack. A quick solution to this is adding the following line to your ~/.bash_profile --
[ "$PATH" =~ "git" ] || export PATH=$PATH:/usr/local/git/bin

this will only add the path if its not already present. Which means interactive shells wont have the same path twice, but non-interactive shells will get it too.

Friday, February 25, 2011

Manually configuring a device for a specific interface

I have a 50 interface linux box that I want to use for testing. Typically these interfaces are auto-created, but this is hassle as I need each of the interfaces to be a specific interface.

I edited vim /etc/udev/rules.d/70-persistent-net.rules to fix this.

Tuesday, December 14, 2010

Perl 1 liners

For a number of reasons I think Perl is an unsightly language, but at my current employer its the language of choice. One place Perl definitely shines is its 1 liners:

http://blog.ksplice.com/2010/05/top-10-perl-one-liner-tricks/

Tuesday, November 16, 2010

screen

I'm just starting to see the power in screen. What is screen?

From the man page:
Screen is a full-screen window manager that multiplexes a physical
terminal between several processes (typically interactive shells).
Each virtual terminal provides the functions of a DEC VT100 termi-
nal and, in addition, several control functions from the ISO 6429
(ECMA 48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete
line and support for multiple character sets). There is a scroll-
back history buffer for each virtual terminal and a copy-and-paste
mechanism that allows moving text regions between windows.


Screen is good for continuous virtual sessions that are not interrupted by network connectivity. IE stays around when you don't want to worry about getting disconnected from the server.

heres me screenrc:
defscrollback 10000
vbell off
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%{y}%H%{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%m/%d %{W}%c%{g}]'

My screenrc (that I lifted from a friend...) shows which virtual terminal you are in and what host you are on.

Be forewarned -- scroll back works a little diffrent you have to use the screen specific mechanism.

Also CTRL-A has special meaning, it does not go to the begging of the line like it does in normal BASH or Emacs.

use CTRL-A CTRL-D to detach from a screen session
use `screen -r ` to reconnect to an old detached session
use `screen -ls` to see open screen sessions

Thursday, November 4, 2010

svn: overwrite local files with repository files

From time to time I want get ride of locally modified files (mostly I end up modifying code for testing purposes). svn revert makes this super easy.

(from svn checked out directory)
svn revert -R .

Friday, October 29, 2010

greping multiple lines

I just found a neat way to grep multiple lines when you only know the contents of one of those lines --

Use -B n to see n lines before the match and -A m to see m lines after the match.

ie. grep -B2 -A2

Example --


root@localhost:~# echo ' Cell 52 - Address: 00:24:6C:AB:26:D3
Protocol:802.11b/g/n
ESSID:"StevesAP"
Mode:Managed
Frequency:2.462 GHz (Channel 11)
Quality:100/100 Signal level:-25 dBm Noise level:-92 dBm
Encryption key:on
Bit Rates:54 Mb/s
IE: IEEE 802.11i/WPA2 Version 1
' | grep -B2 -A2 -i steve

Cell 52 - Address: 00:24:6C:AB:26:D3
Protocol:802.11b/g/n
ESSID:"StevesAP"
Mode:Managed
Frequency:2.462 GHz (Channel 11)