Skip to content

Instantly share code, notes, and snippets.

View rkumar's full-sized avatar
💭
Coming back to this world after a long time

r__k_u_m_a_r rkumar

💭
Coming back to this world after a long time
View GitHub Profile
@rkumar
rkumar / colormap.sh
Created November 14, 2011 07:06
get ansi color codes into environment
# get ansi color codes into environ
# source this file as . ~/bin/colormap.sh
# following codes copied from todo.txt
export NONE=''
export BLACK='\\033[0;30m'
export RED='\\033[0;31m'
export GREEN='\\033[0;32m'
export BROWN='\\033[0;33m'
@rkumar
rkumar / keytest.c
Created September 23, 2011 10:24
ncurses, use_extended_names, trapping Control-arrow
#include <stdlib.h>
#include <ncursesw/ncurses.h>
/* gcc -o keytest -I/opt/local/include -lncurses keytest.c */
/* TERM=xterm ./keytest
Try Control-left, Sh-F9, Control-UP, etc
* */
static struct key {
char *name;
@rkumar
rkumar / error.txt
Created August 26, 2011 05:57
make error for motor
In file included from strfn.c:28:
../include/strfn.h:51: warning: conflicting types for built-in function ‘strndup’
rm -f libsrc.a
ar cru libsrc.a llist.o parlist.o parser.o parser_cgi.o strfn.o
ranlib libsrc.a
rm -f libparser.a
ar cru libparser.a src/llist.o src/parlist.o src/parser.o src/parser_cgi.o src/strfn.o
ranlib libparser.a
Making all in kkstrtext
c++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c kkstrtext.cc
@rkumar
rkumar / testapp2.rb
Created November 19, 2010 18:03
sample rbcurse app inside a class (using App class)
require 'rbcurse/app'
####
# If you want to create an application which can run standalone from terminal, or be passed
# values from a previous form then this is one way you can do it.
#
# this was a test to see how i could have a class and an app inside
# and i could call methods in the class and have variables available
# inside App.
#
#!/usr/local/bin/ruby -w
# prior to running create 2 files:
# touch appemail.rb
# touch appemaillb.rb
# selecting the first gives an ambiguous error
# basic_usage.rb
#
# Created by James Edward Gray II on 2005-04-28.
# Copyright 2005 Gray Productions. All rights reserved.
@rkumar
rkumar / mailread.rb
Created October 19, 2010 13:17
mbox mail reader
# The Mail class represents an internet mail message (as per RFC822, RFC2822)
# with headers and a body.
class Mail
# Create a new Mail where +f+ is either a stream which responds to gets(),
# or a path to a file. If +f+ is a path it will be opened.
#
# The whole message is read so it can be made available through the #header,
# #[] and #body methods.
#
#include <ncurses.h>
// it seems system echo is the only way to print some stuff in cooked mode
// i am trying to figure out how VIM displays the result of :ls
int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!! Hit a key\n"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
@rkumar
rkumar / readmbox.rb
Created September 1, 2010 17:53
read mails from mbox
#!/usr/bin/env ruby -w
#
# this will only work in 1.8.7, since mailread.rb is not present after that
# supply the path of any mbox file such as ~/mbox or ~/mail/read-mail
# and see a listing of mails, then give a msg number and see body
require 'mailread'
BOLD = "\e[1m"
CLEAR = "\e[0m"
@rkumar
rkumar / ncurses124.gemspec
Created August 24, 2010 08:47
gemspec to create ncurses 1.2.4 gem
require "rubygems"
PLUGIN = "ncurses"
NAME = "ncurses"
VERSION = "1.2.4"
AUTHOR = "Tobias Peters"
EMAIL = "t-peters@users.berlios.de"
HOMEPAGE = "http://ncurses-ruby.berlios.de/"
SUMMARY = "This wrapper provides access to the functions, macros, global variables and constants of the ncurses library. These are mapped to a Ruby Module named \"Ncurses\": Functions and external variables are implemented as singleton functions of the Module Ncurses."
@rkumar
rkumar / ncurses.gemspec
Created August 24, 2010 04:36
ncurses gemspec for 0.9.2 (ruby 1.9.2)
require "rubygems"
PLUGIN = "ncurses"
NAME = "ncurses"
VERSION = "0.9.2"
AUTHOR = "Tobias Peters"
EMAIL = "t-peters@users.berlios.de"
HOMEPAGE = "http://ncurses-ruby.berlios.de/"
SUMMARY = "This wrapper provides access to the functions, macros, global variables and constants of the ncurses library. These are mapped to a Ruby Module named \"Ncurses\": Functions and external variables are implemented as singleton functions of the Module Ncurses."