- resource://gre/ - root
- resource:// - browser root
- resource://gre/modules/commonjs/sdk/ - Firefox addon SDK
- resource://gre/modules/commonjs/sdk/test/assert.js - assert object used in SDK tests
Computing
2015-04-25
Useful Firefox built-in resources
2015-04-16
Regular apt-get update
A canonical way to schedule regular apt cache updates is:
cat >> /etc/apt/apt.conf.d/02periodic <<EOF
APT::Periodic::Enable "1";
APT::Periodic::Update-Package-Lists "1";
EOF
Update-Package-Lists is an update interval in days.
This works through /etc/cron.daily/apt
2012-08-19
Delete all Windows update backups
@echo off
for /f "delims=" %%a in ('dir/ad/b %systemroot%\$NtUninstall*') do (
echo %%a
rd /s /q "%systemroot%\%%a"
)
pause
2012-07-02
Run tcpdump with user privileges
There is no need to acquire superuser privileges each time you need to perform some low level tasks. On my system I tend to allow programs like tcpdump, iftop, and some other "safe" programs to have access to required low level features by setting appropriate capability set on their executables.
The following command allows any non-root user to run tcpdump:
sudo apt-get install libcap2-bin
sudo setcap CAP_NET_RAW+ep /usr/sbin/tcpdump
- CAP_NET_RAW - low-level network access capability
- +ep - enable given capability as Effective an Permitted
User can exploit those programs to:
- access sensitive data,
- perform DOS attacks
- perform man in the middle attacks
2011-11-22
ROOT package for debian
ROOT Debian packaging is often late or broken. Users are trying their best themselves. I've decided to join and remake ROOT Debian packaging from scratch.
Debian ROOT packaging system is published on github.
Currently it builds only two packages: libroot and libroot-dev which contain whole ROOT installation. xrootd is not included due to the bug in it's build system. Many more components and plugins are not built to keep dependencies at minimum. Fine grained packaging and useful dependency tags are subject for further improvement.
Debian wiki page watches the progress of main official and unofficial ROOT repositories.
Debian ROOT packaging system is published on github.
Currently it builds only two packages: libroot and libroot-dev which contain whole ROOT installation. xrootd is not included due to the bug in it's build system. Many more components and plugins are not built to keep dependencies at minimum. Fine grained packaging and useful dependency tags are subject for further improvement.
Debian wiki page watches the progress of main official and unofficial ROOT repositories.
2011-11-09
How to build a DKMS Debian package
Dynamic Kernel Module Support is a very simple concept allowing to always keep your kernel and modules up to date. DKMS builds module source on each change of active kernel. All you need is to install source files and register them with one-line command. On the other hand packaging system of Linux distributions makes those tasks even easier managing versioning, conflicts resolution and automated registration.
Suppose you have "mydriver" kernel module. Following is annotated process of packaging for it step by step.
Futher reading: Debian packaging
sudo apt-get install debhelper
debhelper is a set of perl scripts for automated Debian packaging. It helps creating a minimal debian package example in your source tree:
dh_make --single --packagename mydriver-1.2 --native --copyright gpl2
- --single - creates a single deb package template
- --native - tells dh_make to consider current directory as the root of source tree
- --copyright - should be gpl2 (defaults to gpl3) to be compatible with current Linux kernel license
- --packagename - should take argument of form mydriver-version
rm debian/*.ex debian/*.EX debian/README* install
This leaves following files and directories: changelog compat control copyright README rules source substvars
- changelog, copyright, README files are to be (optionally) fixed with your name and comments
- compat and source are file and directory controlling Debian helper behaviour and are to be left as they are
- control file contains your package metainformation. If you are sure that your driver will compile and work on any architecture change Architecture: field to "all".
- substrvars contains variable values that are used in control file. It can be ignored.
#!/usr/bin/make -f
VERSION=$(shell dpkg-parsechangelog |grep ^Version:|cut -d ' ' -f 2)
%:
dh $@ --with dkms
override_dh_install:
dh_install Makefile mydriver.c usr/src/mydriver-$(VERSION)/
override_dh_dkms:
dh_dkms -V $(VERSION)
Rules file does almost everything related to Debian packaging. Follows the explanation of its content.
- VERSION of your package is determined by changelog and Debian policies require changelog to always be up to date. dpkg-parsechangelog parses debian/changelog and outputs information as key: value pairs, one per line. We are selecting "Version" key with grep and obtain its value with cut.
- % target redirects every unknown target to dh perl program provided by debhelper. dh implements all required targets for debian standard rules Makefile, but it can't guess everything and provide "override" mechanism to configure every aspect of packaging, if rules define override_dh_* target it replaces default action that dh usually does.
- override_dh_install installs our sources to the required target location. Actually dh has default dh_install step, which may do this for you (using debian/install configuration file), but it is limited to constant path only, which renders it unusable for dkms installation (requiring module version to be present in target folder name).
- override_dh_dkms it needed for the very same purpose - to avoid updating packet version inside you DKMS configuration file (see below).
PACKAGE_VERSION="#MODULE_VERSION#"
PACKAGE_NAME="mydriver"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="mydriver"
BUILT_MODULE_LOCATION[0]="./"
DEST_MODULE_LOCATION[0]="/kernel/net"
MAKE[1]="make"
AUTOINSTALL="yes"
It will be copied to usr/src/mydriver-$(VERSION)/ by dh_dkms. #MODULE_VERSION# will be replaced by your module version (note that this won't happen if we omit -V key in dh_dkms invocation).
All required files are ready now, we can proceed to building our package with
dpkg-buildpackage -us -uc -b
It will (list nesting shows call nesting):
- clean source tree
- "debian/rules clean"
- "dh clean"
- "make clean"
- "dh clean"
- "debian/rules clean"
- build source tree
- "debian/rules build"
- "dh build"
- "make" which is probably doing nothing as your module actually using Kbuild mechanism leaving Makefile in your source without targets.
- "dh build"
- "debian/rules build"
- build package
- "debian/rules binary"
- install files to a temporary path with
- "dh_dkms" which uses override_dh_dkms, patching dkms configuration and installing it in an appropriate temporary folder
- "make override_dh_install" that installs our sources in the very same temporary folder
- "dh_builddeb" that packages temporary folder into deb package.
- install files to a temporary path with
- "debian/rules binary"
Futher reading: Debian packaging
2010-10-23
A while ago I wrote a python library for parse and statistical analysis of network usage logs generated by net-acct.
A python was used for that implementation.
Later I began to learn Scala in order to make it closer to functional programming world. It seemed that writing simple log parser was an adequate task to take a feeling of language without experiencing extra difficulties.
A nice timing bonus makes me develop scala version futher and drop the python one.
python
real 2m32.052s
user 2m24.957s
sys 0m3.840s
scala
real 0m21.942s
user 0m15.653s
sys 0m0.456s
Tests were done on 6 Mb of gzipped logs with 1833.650 Mhz Athlon (3667.30 bogomips).
P.S. Improvements of configuration subsystem are now making Scala version useful for non-programmers. Documentation is still lacking, but I'm publishing it nevertheless.
A python was used for that implementation.
Later I began to learn Scala in order to make it closer to functional programming world. It seemed that writing simple log parser was an adequate task to take a feeling of language without experiencing extra difficulties.
A nice timing bonus makes me develop scala version futher and drop the python one.
python
real 2m32.052s
user 2m24.957s
sys 0m3.840s
scala
real 0m21.942s
user 0m15.653s
sys 0m0.456s
Tests were done on 6 Mb of gzipped logs with 1833.650 Mhz Athlon (3667.30 bogomips).
P.S. Improvements of configuration subsystem are now making Scala version useful for non-programmers. Documentation is still lacking, but I'm publishing it nevertheless.
Подписаться на:
Сообщения (Atom)