Nitin Verma’s Blog

Posts Tagged ‘unix

1. Search for fonts

$ apt-cache search $favorite_language font
This would search fonts for you, and would probability end up getting the stuff from ubuntu universe.


$ apt-cache search indic font
groff - GNU troff text-formatting system
libqscintilla2-3 - The Qt4 port of the Scintilla source code editing widget
texlive-lang-indic - TeX Live: Indic
texlive-latex-extra - TeX Live: LaTeX supplementary packages
ttf-indic-fonts - Metapackage for free Indian language fonts
ttf-indic-fonts-core - Core collection of free Indian language fonts
ttf-unifont - TrueType version of the GNU Unifont
unifont - font with a glyph for each visible Unicode 5.1 Plane 0 character
xfonts-unifont - PCF (bitmap) version of the GNU Unifont
itrans-fonts - fonts used in the ITRANS Indic text processing system
libhtml-tagcloud-perl - Generate HTML indexes of popular tags
liblasi-dev - development files and documentation for the LASi library
liblasi0 - creation of PostScript documents containing Unicode symbols
qemacs - Small emacs clone editor with HTML and DocBook editing support
qemacs-nox - Small emacs clone editor (without X support)

$ apt-cache search ancient font
texlive-lang-greek - TeX Live: Greek typesetting
ttf-sil-gentium - Gentium extended Unicode Latin font ("a typeface for the nations")
ttf-ancient-fonts - Unicode Fonts for Ancient Scripts
ttf-gfs-baskerville - Ancient Greek font revival
ttf-gfs-complutum - ancient Greek font revival from the University of Alcalá, Spain
ttf-gfs-gazis - ancient Greek font (Byzantine cursive hand style)
ttf-gfs-solomos - ancient Greek oblique font
ttf-gfs-theokritos - decorative Greek font
ttf-linex - Fonts suitable for education and institutional use

2. Install the fonts

$ sudo apt-get install ttf-indic-fonts
$ sudo apt-get install ttf-ancient-fonts
$ sudo apt-get install ttf-kannada-fonts

Installing above three would enable your browser interpret my previous blogs and even let you enjoy running examples on your shell.


Could not find the ancient fonts but everything else is available.

$ sudo yum install fonts-kannada.noarch
$ sudo yum install fonts-tamil.noarch
$ sudo yum install fonts-hindi.noarch
// Refer to my previous post
$ ps -eafwww | grep hw | grep -v grep
nitinv   11703  6642  0 16:42 pts/7    00:00:00 ./hw

$ gcore -o hw.core 11703
(no debugging symbols found)
Using host libthread_db library "/lib/i686/nosegneg/".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0x00fac402 in __kernel_vsyscall ()
Saved corefile hw.core.11703

$ gdb ./hw hw.core.11703
GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/i686/nosegneg/".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/i686/nosegneg/ debugging symbols found)...done.
Loaded symbols for /lib/i686/nosegneg/
Reading symbols from /lib/ debugging symbols found)...done.
Loaded symbols for /lib/
(no debugging symbols found)
Core was generated by `/home/nitinv/codes/grammar/hw'.
#0  0x00fac402 in __kernel_vsyscall ()
(gdb) bt
#0  0x00fac402 in __kernel_vsyscall ()
#1  0x00b1d1d3 in __read_nocancel () from /lib/i686/nosegneg/
#2  0x00abd588 in _IO_file_read_internal () from /lib/i686/nosegneg/
#3  0x00abe930 in _IO_new_file_underflow () from /lib/i686/nosegneg/
#4  0x00abf02b in _IO_default_uflow_internal () from /lib/i686/nosegneg/
#5  0x00ac039d in __uflow () from /lib/i686/nosegneg/
#6  0x00aba10c in getc () from /lib/i686/nosegneg/
#7  0x08048fad in yy_get_next_buffer ()
#8  0x08048c84 in yylex ()
#9  0x08048655 in main ()

This even works with ulimit not set 😉

$ ulimit -a | grep core
core file size          (blocks, -c) 0

Neat way to stop and restart your process to take a dump. This can get handy sometime while getting a good snapshot.
Michael B. Trausch gcore: Obtain core dump of current running application — see comment

flex – fast lexical analyzer generator

// This is the flex version I have.
$ flex -V
flex version 2.5.4

// A Hello World lexical scanner.
$ cat -n hw.lex
     1  %{
     2  // Hello World!!!
     3  %}
     4  %%
     6  [\t ]+  ;
     8  a { printf( "' %s '", yytext); }
     9  hw { printf( "' -%s- '", yytext); }
    10  ^hw$ { printf( "' %s '", yytext); }
    11  ^exit$ { printf( "%s :have a nice day!!!\n", yytext); exit(0); }
    13  %%
    15  int yywrap()
    16  {
    17          return 1;
    18  }

// Generate your C code, with lex debug messages on. ( remove -d if you do not need those ).
$ flex -d -ohw.yy.c  hw.lex

$ more hw.yy.c
#line 2 "hw.yy.c"
/* A lexical scanner generated by flex*/

/* Scanner skeleton version:
 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $


#include <stdio .h>
#include <unistd .h>

/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus

#ifdef __cplusplus

#include <stdlib .h>

/* Use prototypes in function declarations. */

/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST

#else   /* ! __cplusplus */

#if __STDC__

#define YY_USE_CONST

#endif  /* __STDC__ */
#endif  /* ! __cplusplus */

#ifdef __TURBOC__
 #pragma warn -rch
 #pragma warn -use
#include <io .h>
#include <stdlib .h>
#define YY_USE_CONST

// Compile 

$ gcc -o hw -ll hw.yy.c

// Run your lexical scanner binary!!!

$ ./hw
--(end of buffer or a NUL)
--accepting rule at line 10 ("hw
--accepting default rule ("
' hw '
--(end of buffer or a NUL)
--accepting rule at line 9 ("hw")
--accepting rule at line 9 ("hw")
--accepting rule at line 8 ("a")
--accepting default rule ("
' -hw- '' -hw- '' a '
--(end of buffer or a NUL)
hw hw a
--accepting rule at line 9 ("hw")
--accepting rule at line 6 (" ")
--accepting rule at line 9 ("hw")
--accepting rule at line 6 (" ")
--accepting rule at line 8 ("a")
--accepting default rule ("
' -hw- '' -hw- '' a '
--(end of buffer or a NUL)
--accepting rule at line 11 ("exit
exit :have a nice day!!!