Skip to content

Instantly share code, notes, and snippets.

@psibi
psibi / ipython_config.py
Created December 15, 2014 12:18
Ipython configuration
# Configuration file for ipython.
c = get_config()
#------------------------------------------------------------------------------
# InteractiveShellApp configuration
#------------------------------------------------------------------------------
# A Mixin for applications that start InteractiveShell instances.
#
@psibi
psibi / output
Created July 9, 2014 07:44
Cabal sandbox issue
$ cabal install -v3 --only-dependencies
Searching for ghc in path.
Found ghc at /usr/bin/ghc
("/usr/bin/ghc",["--numeric-version"])
/usr/bin/ghc is version 7.6.2
looking for tool ghc-pkg near compiler in /usr/bin
found ghc-pkg in /usr/bin/ghc-pkg
("/usr/bin/ghc-pkg",["--version"])
/usr/bin/ghc-pkg is version 7.6.2
("/usr/bin/ghc",["--supported-languages"])
@psibi
psibi / tree.hs
Created June 17, 2014 02:05
Binary tree
import Control.Applicative
data Tree a = Leaf a
| Node (Tree a) (Tree a)
deriving Show
instance Functor Tree where
fmap f (Leaf a) = Leaf (f a)
fmap f (Node x y) = Node (fmap f x) (fmap f y)
@psibi
psibi / index.html
Created April 2, 2014 19:52
Working jqplot with legends
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
<link href="./jquery.jqplot.min.css" rel="stylesheet"
type="text/css" />
@psibi
psibi / records.sml
Created January 31, 2013 11:10
Pattern Matching Records in SML
(* Pattern Matching in Records
Let us pattern match {first:string,second:string,third:string}
*)
(*You should not code like this.
This code will produce a type of val test = fn : {a:'a, b:'b, c:'c} -> {first:'a, second:'b, third:'c}
So, it creates actually records with fields of a, b and c. This is not what you want.
*)
fun test e =
@psibi
psibi / sample.cpp
Created November 20, 2012 19:37
Integer to String
#include <iostream>
#include <string>
using namespace std;
int main()
{
int number = 50;
string str;
str = to_string(number);
cout<<str;
@psibi
psibi / wvdial.conf
Created November 15, 2012 17:25
wvdial.conf
[Dialer airtel]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","airtelgprs.com"
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99#
@psibi
psibi / sab.py
Created October 30, 2012 10:56
sab python
from Sim import Simulator
a = Simulator()
b = a.start_execution(3,["hi","/home/sibi/Downloads/Softwares/version5/trunk/src/Transims50/alexandria/setup/control/sim.ctl"])
@psibi
psibi / table.html
Created October 22, 2012 16:34
Build table using jQuery
var jobject = $(html_response_data);
$("caption.featureInfo",jobject).remove(); //Removing Caption tag
var mytable = "<table class=\"featureInfo\"><thead>";
var trs = $('tr',jobject);
trs.each(function(i,n) { //console.log($(n).html());
if (i==0) { mytable += $(n).html(); mytable += "</thead><tbody>";}
else { mytable += "<tr>"; mytable +=$(n).html(); mytable += "</tr>";}
});
mytable += "</tbody></table>";
$('#nodelist').html(mytable); //Put the table in the div whose id is "nodelist"
@psibi
psibi / parse.html
Created October 22, 2012 16:17
jQuery object
var body = '<div id="body-mock">' + html_variable.replace(/^[\s\S]*<body.*?>|<\/body>[\s\S]*$/g, '') + '</div>';
var jobject = $(body);