This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* shamelessly copied from: | |
* https://stackoverflow.com/questions/34660459/changing-tab-completion-for-read-builtin-in-bash | |
* And modified a bit | |
* Compile it like | |
* gcc rl.c -lreadline -o rl | |
* And copy the rl binary to the same directory as crepl.sh | |
* */ | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A REPL for C | |
# Mon Feb 11, 2019 | |
# Aniruddha. A (aniruddha.a@gmail.com) | |
if [[ -z $(which gcc) ]]; then | |
echo gcc not installed | |
exit 1 | |
fi | |
readonly FG_BLUE="[34m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
$blk = 0; | |
while (<STDIN>) { | |
chomp $_; | |
if (m/\s>\|<\s/) { | |
($l, $r) = split (/\s>\|<\s/); | |
print "$l\n"; | |
$rhalf{$blk} = { 'start'=>$., 'code' => '' } if not defined $rhalf{$blk}; | |
$rhalf{$blk}{'code'} .= "$r\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test CRUD of an iface in /etc/network/interfaces ( on Ubuntu) | |
// using the Augeas lib | |
// Aniruddha. A (aniruddha.a@gmail.com) | |
// Nov 1, 2014 | |
#include <stdio.h> | |
#include <assert.h> | |
#include <stdarg.h> | |
#include <stddef.h> | |
#include <limits.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Parse::CSV; | |
use strict; | |
my %wb2_table = (); | |
my $workbook2_data = Parse::CSV->new ( file => 'merged_workbook2.csv' ); | |
# Note: the header lines are removed in the CSV files for simplicity | |
# Parse one workbook and load it to a hash | |
while (my $ref = $workbook2_data->fetch) { | |
my @line = @$ref; | |
my $name = $line[5]; # 5th field is the name here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Tue Apr 22 15:46:42 IST 2014 | |
-- Aniruddha. A | |
-- | |
-- just to see how much effort it is to simulate Py like PrettyTable module | |
local function max(a,b) return a < b and b or a end | |
local function printf(...) return io.stdout:write(string.format(...)) end | |
function pad(s, width, padchar) | |
local padder = string.rep(padchar or ' ', width) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
## | |
# Mon Feb 17 14:38:23 IST 2014 | |
# Aniruddha. A (aniruddha.a@gmail.com) | |
## | |
$FG_RESET = "[0m"; | |
$FG_RED = "[31m"; | |
$FG_GREEN = "[32m"; | |
$FG_YELLOW = "[33m"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- An command line example | |
--local S = require 'serpent' -- to see the CLI table | |
local L = require 'linenoise' | |
gt = {} -- The global table to hold all CLIs | |
gfn = {} -- The global table to map CLI to a function | |
function trim(s) | |
local n = s:find("%S") | |
return n and s:match(".*%S", n) or "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <malloc.h> | |
#include <string.h> | |
typedef enum { | |
TOK_ID_VAR = 257, | |
TOK_SQSTR, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <lua.h> | |
#include <lualib.h> | |
#include <lauxlib.h> | |
static int | |
doyield (lua_State *T) | |
{ | |
return lua_yield (T, 0); | |
} |