pmeerw's blog

Tweets

Sun, 11 Oct 2009

nano can do syntax highlighting - oh joy!

Just put a .nanorc file in your $HOME...

set autoindent
set brackets ""')>]}"
set const
set matchbrackets "(<[{)>]}"
set morespace
set punct "!.?"
set quotestr "^([     ]*[#:>\|}])+"
# set tabstospaces
set tabsize 4
include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/html.nanorc"
include "/usr/share/nano/tex.nanorc"
include "/usr/share/nano/patch.nanorc"
include "/usr/share/nano/man.nanorc"
include "/usr/share/nano/python.nanorc"
include "/usr/share/nano/java.nanorc"
include "/usr/share/nano/sh.nanorc"

posted at: 15:45 | path: /programming | permanent link | 0 comments

Fri, 05 Sep 2008

Bluetooth GPS device for Apemap

Apemap is a mobile application for off-road navigation, not much use without a GPS receiver.

For testing, I enabled a Linux PC to act as a Bluetooth GPS device to which Apemap can connect. As is, the program (gpsd.py) provides NMEA GPS data from gpsd.mainframe.cx (Sunnyvale, CA, USA), but one could easily connect some other local GPS receiver.

posted at: 19:22 | path: /programming | permanent link | 0 comments

Sun, 31 Aug 2008

Bluetooth and Python

posted at: 11:39 | path: /programming | permanent link | 0 comments

Mon, 21 Jul 2008

Obfuscation pointers

On obfuscating SQL queries,here is an example:

select"NVL2"(q'<'>',"UTL_RAW".cast_to_varchar2(to_char(stats_mode(column_value)+exp(sum(ln(rownum*tan((select"REGEXP_SUBSTR"(xmltype(oracle).extract('/ROWSET/ROW/_x0032_'),'[^>:D<^]+',9)from(select"MAX"(decode(rownum,316,"+"))ilu,max(decode(rownum,845,"+"))"INU"from(select/*--*/UNIQUE/*@*/KEYWORD"+"from"V$RESERVED_WORDS"))model/*..-*/partition/*----*/by('"DUAL"'world)dimension/*--*/by(7.67e183d"X")measures(ilu,inu,lpad(':*',999)oracle)(oracle[any]=to_char(dbms_xmlgen.getxml(concat(inu[cv()],'+1."2"')||ilu[cv(x)]||cv(world)))))+.27322671529864645387899781380413953366)))),rpad('FM',34,'X')))||Initcap(concat(regexp_substr(dburitype('/SYS/DBA_PROCEDURES/ROW[PROCEDURE_NAME=''GETKEY'']/OBJECT_NAME').getxml().getstringval(),'_O.*S......_',35),replace((select"STATS_MODE"(regexp_substr(table_name,'[COTTON+XE]{4,}'))from"DICT"),'X','S'))),count(*))from/**/table(sys.odcinumberlist(4*23))connect/**/by.1>1.connect/**/by.25>rownum/100.group/**/by()
/
There have been three Haskell obfuscation contests, here is an example:
module Main where{import List;import System;
 import Data.HashTable as H;(???????)=(concat
 );(??????)(???)(????)=((groupBy)(???)(????))
 ;(??????????????????????)(????)=((??????????
 )((tail).(???????))((????????????????????)((
 ??????)(?????????????????????)(????))));(??)
 =([' ']);(??????????????)=((hashString));(?)
 =((>>=));(???????????????????????)([((???)),
 (????)])=((?????????????)(???))?(\(?????)->(
 (????????????????)(==)(??????????????))?(\((
 ???))->((??????????????????)(???????????????
 )(???)(?????))>>((?????????????????)(???))?(
 \((?????))->((((???????????????????)((????))
 ((??????????????????????))((?????))))))));((
 ???????????????????????))(??)=(????????????)
 ("usage f dic out");(?????????????????????)(
 (???),(??????))((????),(????????????????????
 ))=((???)==(????));(?????????????????)(???)=
 (toList)(???);(????????????????????)(????)=(
 ((??????????)(((??????????)(snd)))((????))))
 ;(??????????????????)(???????????????)(???)(
 (?????))=(((mapM)(((???????????????)(???)))(
 (lines)(?????))));(???????????????????)(????
 )(???????????????????????)(?????)=(?????????
 )(????)((unlines)((???????????????????????)(
 ?????)));(????????????????)(???)((????))=(((
 new)(???)(????)));(main)=((???????????)?(((\
 (???)->((???????????????????????)(???))))));
 (???????????????)(???)(????)=((????????)(???
 )((sort)(????))((??)++(????)));(???????????)
 =(getArgs);(????????????)(???)=((((print))((
 ???))));(??????????)(???)(????)=(((map)(???)
 (????)));(????????)((???))(????)(?????)=((((
 H.insert))((???))(????)(?????)));(?????????)
 ((???))((????))=(((writeFile)(???)((????))))
 ;(?????????????)(???)=(((readFile)((???))))}
In Python you'd nest lambda expressions... below codes computes the primes < 1000:
print filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,
map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))
And some obfuscated Python treats, such as a Brainf*ck interpreter; and a commercial Python obfuscator!

posted at: 15:28 | path: /programming | permanent link | 0 comments

Thu, 17 Jul 2008

icc rocks on MC-EZBC

I tried the Intel C/C++ compiler (icc), 10.1.017, with MC-EZBC, see also my post on PGO with gcc.

icc 10.1.012 failed to compile the code, probably some compatibility issue with the gcc 4.2.3 installed on my system. The auto-vectorizer has to be disabled (-no-vec), otherwise the executable crashes.

Apart from that, the results are excellent (decoding 32 frames of the Foreman sequence, Intel Core2 Duo 2.66 GHz):

The fastest gcc results is 10.2 sec.

posted at: 14:48 | path: /programming | permanent link | 0 comments

Made with PyBlosxom