Skip to content

Instantly share code, notes, and snippets.

using asp = Company.AspFunctions;
namespace _TestProjects
{
class AspFunctionsTest
{
public string TestAspFunctions()
{
Console.WriteLine("year = " + asp.Conn.Date_Format(DateTime.Now, "%Y%m%d"));
return null;
}
@abhi1010
abhi1010 / gist:1dc4ecebcd1178ef7a40
Created May 7, 2014 14:27
Multiple Inheritance in C++
#include <iostream>
using std::endl;
using std::cout;
class Foo
{
public: Foo() { std::cout << std::endl << "Foo ";}
};
class Bar: virtual Foo
{
@abhi1010
abhi1010 / MultipleInheritance.cpp
Created May 7, 2014 14:39
Multiple Inheritance in C++
#include <iostream>
using std::endl;
using std::cout;
class Foo
{
public: Foo() { std::cout << std::endl << "Foo ";}
};
class Bar: virtual Foo
{
using asp = Company.AspFunctions;
@abhi1010
abhi1010 / gist:924a5f12f3067ba0b3af
Last active August 29, 2015 14:01
Print out sections
# Useful command to get the group of log lines that:
# - Start with a keyword
# - End with a keyword
# Works on gzip files as well
# Breaks all groups by printing ---- in between as well.
# Note: Only works well when you have a well defined begin and end keyword else everything might be printed out
group() #Usage = 'group filename printBeginKeyword printUntilKeyword NumOfLines' // Works with regex
{
if [[ "$#" -lt 3 ]]
then
@abhi1010
abhi1010 / gist:8eed9133ed91cbb42854
Created May 19, 2014 07:22
Modify Putty Window Title
PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
#Long Version of Putty Title
#PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# Modify the title of the Putty window on your windows env
function title
{
if [ "$TERM" == "xterm" ] ; then
# Remove the old title string in the PS1, if one is already set.
@abhi1010
abhi1010 / ReadExcel.cs
Last active August 29, 2015 14:01
Read Excel in C#
public static void readExcelFile(string fileLocation, int workbookIndex, int worksheetIndex)
{
// First open the Excel file
Application excelApp = default(Application);
excelApp = new Application();
excelApp.Workbooks.Open(fileLocation);
// WorkBooks can be counted by using excelApp.Workbooks.Count
// To find out how many worksheets are there, on index 'workbookIndex' use the following:
// - excelApp.Workbooks[workbookIndex].Worksheets.Count
@abhi1010
abhi1010 / LinkedList.cpp
Created June 7, 2014 10:46
Linked List Basic Class
class Node
{
Node* next;
int data;
public:
friend class NodeAlgo;
~Node(void);
@abhi1010
abhi1010 / Node.DeleteNode.cpp
Created June 7, 2014 10:47
Delete a Node from Linked List
Node* deleteNode(Node* head,int d)
{
Node* n = head;
if (head->data == d)
{
n = n->next;
delete head;
return n;
}
@abhi1010
abhi1010 / node.rem.duplicates.cpp
Created June 7, 2014 16:49
Remove Duplicates from Linked Lir
void removeDuplicates(Node* node)
{
Node* n = node;
std::set<Node*, Node_Comparable> nodeSet;
nodeSet.insert(n);
while (n->next != NULL)
{
std::pair<std::set<Node*>::iterator, bool> ret = nodeSet.insert(n->next);
if (ret.second) // element not there
{