I wrote that little helper because webdeveloper toolbar didn't show all methods to me. Maybe it's useful for you too.
https://gist.github.com/1441816
Mittwoch, 7. Dezember 2011
Donnerstag, 1. Dezember 2011
console.log & debug flag?
Instead of checking the DEBUG flag everytime you need a debug info, like this:
if (DEBUG) {
console.log("my debug output");
}
you can just check the DEBUG flag once and disable the console.log function, like this:
if (DEBUG === false) {
console = {
log: function() {}
};
}
This enables you to simply call:
console.log("my debug output")
in your application. If DEBUG is true, you'll get your output. If DEBUG is false, console.log() will be called but is an empty function and thus will produce no output / error.
if (DEBUG) {
console.log("my debug output");
}
you can just check the DEBUG flag once and disable the console.log function, like this:
if (DEBUG === false) {
console = {
log: function() {}
};
}
This enables you to simply call:
console.log("my debug output")
in your application. If DEBUG is true, you'll get your output. If DEBUG is false, console.log() will be called but is an empty function and thus will produce no output / error.
Samstag, 19. November 2011
Automated slackware package creation from given sourcefile
Slackware packages are a great (the only good way) to keep track of the installed software on (and to cleanly remove installed software from) your slackware machine.
Most packages that you can find in the www (slackbuilds.org, http://packages.slackware.it, ...) are outdated. You know that: Looking at slackbuilds.org for a tool, then looking at the version number and see that there's a source on the builders homepage that's x major and y minor releases further.
I, personally, hate to install 'old' software. I want the newest. So I have to built from source - make, ./configure --flags, make install to a DESTDIR, cp docs, change rights and makepkg at the end.
This sucks. To learn a bit about writing shellscripts I started to write a shellscript that does the job (yes, I know about pkgbuild). Currently it's able to:
NOTE: I don't make any warranties that my script will work for you or won't fuck up your machine.
NOTE: I don't make any warranties that my script will work for you or won't fuck up your machine.
Most packages that you can find in the www (slackbuilds.org, http://packages.slackware.it, ...) are outdated. You know that: Looking at slackbuilds.org for a tool, then looking at the version number and see that there's a source on the builders homepage that's x major and y minor releases further.
I, personally, hate to install 'old' software. I want the newest. So I have to built from source - make, ./configure --flags, make install to a DESTDIR, cp docs, change rights and makepkg at the end.
This sucks. To learn a bit about writing shellscripts I started to write a shellscript that does the job (yes, I know about pkgbuild). Currently it's able to:
- remove old sources
- remove old package
- extract the source package (tar.gz / tar.bz2)
- copy a given layout file (supported by apache httpd for instance)
- make install to DESTDIR
- create documentation directory
- copy documentation files (like README, INSTALL, AUTHORS...)
- chown root.root DESTDIR
- build package with makepkg
- echo build time
- remove sources after successful build
- remove installation from DESTDIR after successful build
- automatically search SRCDIR for documentation and copy it
- really important: create slack_desc for created package
- really important: output last 5 rows if build fails
- really important: check for $DESTDIR support
- make it much cleaner
- less params
NOTE: I don't make any warranties that my script will work for you or won't fuck up your machine.
NOTE: I don't make any warranties that my script will work for you or won't fuck up your machine.
Labels:
automated build,
build,
buildfile,
package,
packages,
Shellscript,
Slackware,
source,
tgz
Montag, 7. November 2011
Signs that you are a bad programmer (Bad Programmers)
Quite interesting article: http://badprogrammer.infogami.com/
Sonntag, 2. Oktober 2011
Measuring compile time to check overclocking of cpu
Step 1:
Use standard cpu clock and a source of medium size:
time -p ./configure && make
and note down time next to 'real'.
Step2:
Remove sources, extract again, overclock cpu and run
time -p ./configure && make
Use standard cpu clock and a source of medium size:
time -p ./configure && make
and note down time next to 'real'.
Step2:
Remove sources, extract again, overclock cpu and run
time -p ./configure && make
again. Compare the value next to 'real' with the noted down value.
Dienstag, 27. September 2011
Asus S.H.E. for Ubuntu (Jupiter)
'overclock' Asus netbook cpu in Ubuntu via Jupiter: http://www.webupd8.org/2010/07/jupiter-ubuntu-ppa-hardware-and-power.html
Abonnieren
Posts (Atom)