This is meant as a cheat-sheet / reference page for the different tools I use.
cyclictest
Used to measure scheduling latency...
TODO: walk through installation instructions (assuming cited do not work exactly).
Main site: https://rt.wiki.kernel.org/index.php/Cyclictest
emacs
wrap behavior
Okay, first I'm going to change the line wrapping behavior (global-visual-line-mode t) to init file (is that .emacs?)
org-mode
Has a ton of features.
- insert time stamps with C-u C-c .
- Supports spreadsheets with formulas:
| run number | Avg. Vel | Min. Dist. |
|------------+----------------+------------|
| 0 | 0.268891349714 | 0.40411 |
| 1 | 0.230950592517 | 0.290314 |
| 2 | 0.269491072346 | 0.371258 |
| 3 | 0.235296387658 | 0.369014 |
| 4 | 0.271092925878 | 0.285548 |
| 5 | 0.267199856097 | 0.36826 |
| 6 | 0.26744661873 | 0.314621 |
| 7 | 0.268253904548 | 0.41475 |
| 8 | 0.231120825034 | 0.308739 |
| 9 | 0.269125189837 | 0.414856 |
|------------+----------------+------------|
| ALL | 0.25788687 | 0.285548 |
#+TBLFM: @12$2=vmean(@2$2..@11$2)::@12$3=vmin(@2$3..@11$3)
pmwiki
Installation:
- Requires a web-server and php support. I use lighttpd:
> sudo apt-get install lighttpd php5-cgi
> sudo lighty-enable-mod fastcgi
> sudo lighty-enable-mod fastcgi-php
> sudo service lighttpd force-reload
Test that your machine is now running a webserver by checking http://127.0.0.1/
Test that php is running by creating /var/www/index.php
with the contents: <?php phpinfo(); ?>
- pmwiki is just a collection of php files, so is just needs to be downloaded and unpacked into
/var/www/wiki/
.
The wiki should now be available at http://127.0.0.1/wiki/pmwiki.php.
I set everything in the wiki/
directory to be editable by everyone with:
> chmod -R 777 *
This may not be a great idea. You may also need to create a directory wiki/wiki.d
Configuration:
This can be a bit of a pain, since you must deal with pmwiki's configuration as well as php's configuration. I remember this was a problem when trying to increase the maximum upload size. Another note: while the latest pmwiki version is compatable with the latest php version (deprecated /e, turns your wiki into a sea of warning messages no matter how hard you try to disable them), many of the "cookbook" recipes are not up to data. Thus my tables are now ugly (simplerowspan recipe).
- Copy sample configuration:
The welcome page will list some basic first steps. It is highly recommended that you read them. One of the suggestions is to set up your config file:
> cd /var/www/wiki/
> sudo cp ./docs/sample-config.php ./local/config.php
- Set a cool (or uncool, whatever) picture:
In config.php, uncomment and edit the following lines:
$
WikiTitle = 'PmWiki';
$
PageLogoUrl = "$
PubDirUrl/skins/pmwiki/pmwiki-32.gif";
Note that $
PubDirUrl
will be /var/www/wiki/pub/
- Increase upload file size:
The max upload size is actually affected by several configuration files, the first of which is for pmwiki itself. Then you have to make sure that the http server / php isn't limiting it as well. System Limits page.
- Setting pmwiki limit:
In /var/www/wiki/local/config.php
Set the following lines as appropriate (my configuration shown):
$
EnableUpload = 1;
# $
UploadPermAdd = 0;
$
DefaultPasswords['upload'] = crypt('your_password_here');
$
UploadMaxSize = 100000000;
- Php limit:
There are two settings files which I edited, /var/www/wiki/.user.ini
and /etc/php5/cgi/php.ini
. In both I set following line:
upload_max_filesize = 10M
The entirety of .user.ini
is as follows:
memory_limit = 64M
post_max_size = 12M
upload_max_filesize = 10M
max_execution_time = 60
Daily use:
My use is fairly non-standard. I keep a master copy on a thumb drive. To edit, this is copied onto a computer, edited via the local web server running there, and then copied back to the thumb drive and archived. The copying / archiving is achieved with a simple script: copy_backup.sh.
Occasionally I upload a static copy to my school webspace. I have instructions for this process as well as a script to download the website using wget
and then removing the vast majority of .pdfs (mostly academic papers that I do not intend to re-host) all available on github. Most of this is specific to my setup, which includes a kludgy script for generating the non-wiki parts of my website.
Python
matplotlib for stats and graphs
Install with:
>sudo apt-get install python-matplotlib
latex
Hmm... I should probably display the name here correctly...
Helpful links:
Wiki book
Previously used VMware, which has a friendly GUI. It also requires a license, which has to be renewed every year (at least the academic version).
Fortunately, QEMU is an open source project that has become robust enough for my purposes. It has a bit higher learning curve, but it's use is becoming widespread.
Setup
Up until now I have been using the raw
file format. However, the qcow2
format may be preferable since it allows snapshots.
Later versions of Ubuntu (after 10.04) seem to have issues as a guest OS. I need to look into this more.
Using
To bring up the command mode:
ctrl+alt+2
quit
exits cleanly (for example after the guest has been shutdown normally.
Taking snapshots from the command line (disk image should be in the qcow2
format)
When running a VM with the same architecture as the host system, qemu-kvm
should provide better performance.
valgrind --leak-check=yes myprog arg1 arg2
GDB
This section could get really long, but there are better resources out there.
gdb ./executable <pid>
Attach GDB to a currently running process.
gdb> dump binary memory file.txt start_address end_address
Dumps a memory range to a file. Addresses are pretty smart; something like array_var+10
will give you the 10th element of the array.
p (print) and x (examine) are both handy, and you can specify the formatting: manual.
Random Bits
rename 's/^/prefix/' file_names
- rename groups of files in bulk. This command adds a prefix.
git log -Gsearch_exp
- searches through previous commits!
pmap
- shows the memory usage of a process.
/proc/<pid>/status
- also shows memory information.
chrt 98 bash
- execute command (bash
) as a real-time (round robin default) process with a priority of 98.
Want to call a c library from c++? Create an extern "C" { }
block for the header includes (SO explanation).
sed -e '1,3d' < file.txt
removes the first two lines from a file. There is a lot that can be done with sed
and awk
.
sed -i '1,3500!d' files_*
keeps only the first 3.5k lines. Notice that -i
does not need the redirect. More examples with deleting lines here.
ps
is extremely versitile:
ps -ao pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:20,comm
... check the wait channel. Good explanation of wait channels here: http://askubuntu.com/questions/19442/what-is-the-waiting-channel-of-a-process.
ps -ao min_flt,maj_flt
displays page faults
ls | cat -n
number the items in a directory. Why do I even need to do this? Oh yeah, starts at 1.