Use Publish or Perish:
https://harzing.com/resources/publish-or-perish
Tuesday, November 21, 2017
Tuesday, November 14, 2017
Format code in blog
http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script> <script language='javascript'> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script>
paste it into your Blogger Template just above the </head> tag
Save the template
Use the pre tag
<pre class="brush: csharp">
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script> <script language='javascript'> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script>
Use the pre tag
<pre class="brush: csharp">
// Comment
public class Testing {
public Testing() {
}
public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
}
}
</pre>
public class Testing {
public Testing() {
}
public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
}
}
</pre>
// Comment
public class Testing {
public Testing() {
}
public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
}
}
Saturday, November 4, 2017
vim notes
example .vimrc
:highlight to see the highlights
Code indent problem when pasting from system to vim
1. use registers
2. :set paste and :set nopaste
Edit multiple files
use buffers:
:edit filename (:e) to open another file
:ls to list all the buffers
:bn switch to the next buffer
:b# switch to the # buffer, # is the buffer number
:b filename switch to filename
:bd delete current buffer
:bd# delete buffer #
use windows:
Ctrl-W s to split the current window horizontallyCtrl-W v to split the current window vertically.
:split and :vertical split (:sp and :vs)
Ctrl-W w to switch between open windows, and
Ctrl-W h (or j or k or l) to navigate through open windows.
Ctrl-W c to close the current window, and
Ctrl-W o to close all windows except the current one.
use tabs:
:tabe filename to open a filevim -p a/*.php opens the same files in tabs
gt and gT switch tabs back and forth
:q closes only the current tab
:qa closes everything and exits
:tabo closes everything but the current tab
Cursor moving
escshift-A moves cursor to the end of line and change to insert mode
Move cursor left one char in insert mode
I would argue that Control-ol (thats a lowercase L) is faster than escshift-A and the right arrow key. Control-o lets you execute one normal mode keystroke from insert mode.
Case insensitive search
You need to use the \c escape sequence. So:/\ccopyright
To do the inverse (case sensitive matching), use \C instead.
:set ic
case sensitive
case sensitive
:set noic
https://stackoverflow.com/questions/1737163/traversing-text-in-insert-mode
https://stackoverflow.com/questions/1737163/traversing-text-in-insert-mode
The right way is to press Esc, go where you want to do a small correction, fix it, go back and keep editing. It is effective because Vim has much more movements than usual character forward/backward/up/down. After you learn more of them, this will happen to be more productive.
Here's a couple of use-cases:
- you accidentally typed "accifentally". No problem, the sequence EscFfrdA will correct the mistake and bring you back where you've been editing it. Ff movement will bring you back to the first encountered "f" character. Compare with Ctrl+<-->->->->deldEnd, that does virtually the same in a casual editor, but takes more keystrokes, makes you move your hand out of alphanumeric space of the keyboard.
- you accidentally typed "you accidentally typed", but want to correct it to "you intentionally typed". Then Esc2bcw will erase the word you want to fix and bring you to insert mode, so you can immediately retype it. To get back to editing, just press A instead of End, to reach which you should move your hand
- you accidentally typed "mouse" instead of "mice". No problem - the good old Ctrl+W will delete the previous word without going out from insert mode. And it happens to be much faster to erase small word than to fix errors in it. I'm so used to it that I had closed the browser page when I was typing this message...
- repetition count is largely underused. Before making a movement, you can type a number; and the movement will be repeated this number of times. For example, 15h will bring you 15 characters back and 4j will scroll you 4 lines down. Start using them and you'll get used soon and find out that pressing 10 times <- key is less fast than iterative approach to moving cursor, when you type 12h, notice that you made a mistake and immediately correct yourself with ll.
vnc notes
Get remote desktop instead of terminal only
~/.vnc/xstart (example at: https://archive.realvnc.com/pipermail/vnc-list/2006-March/054336.html)
#!/bin/sh
## makes copy/paste work for realvnc
vncconfig -nowin&
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
------------------ examples
#!/bin/tcsh
# copy/past sync-up between different X-window buffers
if (-x /cadtools/contrib/bin/autocutsel) then
/cadtools/contrib/bin/autocutsel -fork
endif
# using realvnc?
if ($VNCHOME =~ /cadtools/apps/vnc/real*) then
# makes copy/paste work for realvnc
vncconfig -nowin &
else
# keyboard mapping for tightvnc
if (-r $HOME/xmodmap/vnc.txt) then
xmodmap $HOME/xmodmap/vnc.txt
endif
endif
# .Xdefaults loadings
if (-r $HOME/.Xdefaults) then
xrdb $HOME/.Xdefaults
endif
# Window manager startup
if (`/bin/uname -s` == "Linux") then
### gnome Linux RHELv3 or RH8 ###
unset SESSION_MANAGER
unsetenv SESSION_MANAGER
unsetenv LD_LIBRARY_PATH
exec gnome-session
else
### olvwm legacy Solaris env ###
exec olvwm
endif
~/.vnc/xstart (example at: https://archive.realvnc.com/pipermail/vnc-list/2006-March/054336.html)
#!/bin/sh
## makes copy/paste work for realvnc
vncconfig -nowin&
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
------------------ examples
#!/bin/tcsh
# copy/past sync-up between different X-window buffers
if (-x /cadtools/contrib/bin/autocutsel) then
/cadtools/contrib/bin/autocutsel -fork
endif
# using realvnc?
if ($VNCHOME =~ /cadtools/apps/vnc/real*) then
# makes copy/paste work for realvnc
vncconfig -nowin &
else
# keyboard mapping for tightvnc
if (-r $HOME/xmodmap/vnc.txt) then
xmodmap $HOME/xmodmap/vnc.txt
endif
endif
# .Xdefaults loadings
if (-r $HOME/.Xdefaults) then
xrdb $HOME/.Xdefaults
endif
# Window manager startup
if (`/bin/uname -s` == "Linux") then
### gnome Linux RHELv3 or RH8 ###
unset SESSION_MANAGER
unsetenv SESSION_MANAGER
unsetenv LD_LIBRARY_PATH
exec gnome-session
else
### olvwm legacy Solaris env ###
exec olvwm
endif
command line notes
get total number of processes
ps -ef | grep -v 'PID' | wc -l
get desktop resolution ------------------
xdpyinfo | grep 'dimensions:'
chmod ---------------------------
4 read (r)
2 write (w)
1 execute (x)
u stands for user.
g stands for group.
o stands for others.
a stands for all.
chmod u+x somefile will grant only the owner of that file execution permissions
get desktop resolution ------------------
xdpyinfo | grep 'dimensions:'
chmod ---------------------------
4 read (r)
2 write (w)
1 execute (x)
u stands for user.
g stands for group.
o stands for others.
a stands for all.
chmod u+x somefile will grant only the owner of that file execution permissions
chmod +x somefile is the same as chmod a+x somefile.
owner group all_users
Practical Examples
chmod 400 mydoc.txt read by owner
chmod 040 mydoc.txt read by group
chmod 004 mydoc.txt read by anybody (other)
chmod 200 mydoc.txt write by owner
chmod 020 mydoc.txt write by group
chmod 002 mydoc.txt write by anybody
chmod 100 mydoc.txt execute by owner
chmod 010 mydoc.txt execute by group
chmod 001 mydoc.txt execute by anybody
Wait! I don't get it... there aren't enough permissions to do what I want!
Good call. You need to add up the numbers to get other types of permissions...
So, try wrapping your head around this!!
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)
chmod 666 mydoc.txt read/write by anybody! (the devil loves this one!)
chmod 755 mydoc.txt rwx for owner, rx for group and rx for the world
chmod 777 mydoc.txt read, write, execute for all! (may not be the best plan in the world...)
kill ---------------------------
kill -[signal or option] PID(s)
Signal Name Signal Value Behaviour
SIGHUP 1 Hangup
SIGKILL 9 Kill Signal
SIGTERM 15 Terminate
ldd ------------------------
nm -----------------------
owner group all_users
Practical Examples
chmod 400 mydoc.txt read by owner
chmod 040 mydoc.txt read by group
chmod 004 mydoc.txt read by anybody (other)
chmod 200 mydoc.txt write by owner
chmod 020 mydoc.txt write by group
chmod 002 mydoc.txt write by anybody
chmod 100 mydoc.txt execute by owner
chmod 010 mydoc.txt execute by group
chmod 001 mydoc.txt execute by anybody
Wait! I don't get it... there aren't enough permissions to do what I want!
Good call. You need to add up the numbers to get other types of permissions...
So, try wrapping your head around this!!
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)
chmod 666 mydoc.txt read/write by anybody! (the devil loves this one!)
chmod 755 mydoc.txt rwx for owner, rx for group and rx for the world
chmod 777 mydoc.txt read, write, execute for all! (may not be the best plan in the world...)
kill ---------------------------
kill -[signal or option] PID(s)
Signal Name Signal Value Behaviour
SIGHUP 1 Hangup
SIGKILL 9 Kill Signal
SIGTERM 15 Terminate
ldd ------------------------
nm -----------------------
gdb on Mac
https://stackoverflow.com/questions/18423124/please-check-gdb-is-codesigned-see-taskgated8-how-to-get-gdb-installed-w
Useful update commands for Mac
# Get OS X Software Updates, and update installed Ruby gems, RBENV, Homebrew, npm, and their installed packages, and oh_my_zsh
alias update='sudo softwareupdate -i -a; brew update; brew upgrade --all; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update;rbenv rehash;upgrade_oh_my_zsh'
Can't change default app in Mac
Run:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -all local,system,user
Subscribe to:
Comments (Atom)