Skip to content

Instantly share code, notes, and snippets.

@pstef
Created August 16, 2021 21:16
Show Gist options
  • Save pstef/de2adf998096959fcb9ca4acb3f1d0de to your computer and use it in GitHub Desktop.
Save pstef/de2adf998096959fcb9ca4acb3f1d0de to your computer and use it in GitHub Desktop.
pstef@thinkpad:~ $ for i in `apropos -w .` ; do printf '%s,"%s"\n' "$(basename $i)" "$(zcat $i | mandoc -T html | sed -En '/<h1.*id="(SUMMARY|DESCRIPTION)">/,/<\/section>/p' | sed '/<h1.*/d;/^$/d;s/"/\"/g' | tr -s '\n' ' ' | sed 's/<[^>]*>//g')" ; done > man.csv
pstef@thinkpad:~ $ sqlite3 man.db "CREATE VIRTUAL TABLE test USING fts5(title unindexed, text, tokenize = 'porter unicode61');"
pstef@thinkpad:~ $ sqlite3 man.db
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
sqlite> .mode csv
sqlite> .import man.csv test
sqlite> SELECT rank, title, snippet(test, 1, '<', '>', '', 5) FROM test WHERE text MATCH 'set timer' ORDER BY rank;
-10.8040906839996,timer_getoverrun.2.gz,"last <set> by <timer>_settime"
-10.4134584558555,getitimer.2.gz,"call <sets> a <timer> to"
-10.1260879950166,sscop.1.gz,"m <Set> SSCOP <timer> t"
-9.45704429832938,CURLMOPT_TIMERDATA.3.gz,"the <timer> callback <set> with"
-9.4463462189738,CURLMOPT_TIMERFUNCTION.3.gz,"Your callback function <timer>_callback"
-9.34728761909343,poll_dispatch.3.gz,"A <timer> is created with"
-9.03681738701088,deregister_tcp_functions.9.gz,"<timer> fires by <setting> a"
-9.01264094826869,viawd.4.gz,"watchdog interrupt <timer> present on"
-8.47056959664749,siginfo.3.gz,"<timer> <set> by <timer>_settime"
-8.04359779111396,XkbPtrActionX.3.gz,"XkbSA_MoveAbsoluteX If <set>, the"
-8.04359779111396,XkbPtrActionY.3.gz,"XkbSA_MoveAbsoluteX If <set>, the"
-8.04359779111396,XkbSetPtrActionX.3.gz,"XkbSA_MoveAbsoluteX If <set>, the"
-8.04359779111396,XkbSetPtrActionY.3.gz,"XkbSA_MoveAbsoluteX If <set>, the"
-7.96282623812684,snd_es137x.4.gz,"latency <timer> <setting>. Increasing this"
-7.87003764251706,clock_nanosleep.2.gz,"<TIMER>_ABSTIME flag is <set>"
-7.49687146476196,alarm.3.gz,"function <sets> a <timer> to"
-7.38498120897901,ibv_modify_qp.3.gz,"<TIMER> <Set> min_rnr_<timer>"
-7.26269518075656,Time::HiRes.3.gz,"This higher resolution <timer> can"
-6.75891482726995,pcap-tstamp.7.gz,"The pcap_<set>_tstamp_precision"
-6.14897607163752,dummynet.4.gz,"HZ <set> the <timer> granularity"
-6.06898933323196,kevent.2.gz,"<timers>, this filter automatically <sets>"
-5.89145201363439,RAND_DRBG_bytes.3.gz,"requested by <setting> the prediction"
-5.57096395405538,Xss.3.gz,"If no bits are <set>"
-5.48545725879748,fork.2.gz,"All interval <timers> are cleared"
-5.02999010620628,curl_multi_add_handle.3.gz,"is not <set> to use"
-5.0266924736073,curl_multi_poll.3.gz,"multi handle <set>. It will"
-4.8192194621053,SW_WATCHDOG.4.gz,"<set>/reset the <timer> WDIOC"
-4.75535758261075,curs_get_wch.3.gz,"curses <sets> a <timer>. If"
-4.71886662551673,sysconf.3.gz,"<set>-group and saved <set>"
-4.71227751544699,sqlite3.1.gz,"statement or <set> of SQL"
-4.67476890642947,clock_getres.2.gz,"retrieve or <set> the value"
-4.24138041368786,sigvec.2.gz,"The system defines a <set>"
-4.22491733188103,signal.3.gz,"To <set> the default action"
-3.85741599388394,CCV.9.gz,"name and <set> of hook"
-3.69780328690616,uftdi.4.gz,"UFTDIIOC_<SET>_LATENCY (int) <Set>"
-3.59716895841022,sigaction.2.gz,"The system defines a <set>"
-3.56863416025318,getsockopt.2.gz,"If SO_RCVLOWAT is <set>"
-3.37792229055181,execve.2.gz,"The zeroth argument is <set>"
-3.37038332426945,camcontrol.8.gz,"<timer> <Set> the <timer> value"
-3.33449095430396,spppcontrol.8.gz,"The reported <settings> include the"
-3.33243793150074,netstat.1.gz,"p <Set> if listening promiscuously"
-2.92409477318936,callout.9.gz,"a periodic <timer>, it must"
-2.84823049500271,rtsol.8.gz,"These <settings> are required for"
-2.12636952766002,pcap.3.gz,"The snapshot length is <set>"
-1.68698479329313,ifconfig.8.gz,"If you have incorrectly <set>"
-1.65412641179044,CPAN::FirstTime.3.gz,"can <set> a <timer> that"
-1.61703382270999,tcp.4.gz,"TCP_CCALGOOPT <Set> or query"
-1.57231086283382,EVENTHANDLER.9.gz,"address is <set> up on"
-1.49016172780619,rc.conf.5.gz,"<set>, start a watchdog <timer>"
sqlite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment