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
Node* findKthToLastElement (Node* node, unsigned short k) | |
{ | |
Node* secondRunner = node; | |
for(unsigned short i = 0; i < k; ++i) | |
{ | |
if (secondRunner->next != NULL) | |
secondRunner = secondRunner->next; | |
else | |
return NULL; | |
} |
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
Node* sendToOtherList(Node* otherSideList, Node* n) | |
{ | |
n->next = NULL; | |
if (otherSideList) | |
{ | |
otherSideList->next = n; | |
otherSideList = otherSideList->next; | |
} | |
else | |
{ |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
## Change only the first three variables. Rest should be same. | |
DIR='/tmp/' | |
GIT_LOCATION='https://[email protected]/tildesg/reconwisev1.git' | |
VENV=$DIR/v_env_rw1 | |
## You cannot change the following | |
RW='reconwisev1' | |
cd $DIR | |
### Delete the folders if they already exist |
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
alias cu='curl -Fclient=GH -F"Newedge SGX T+1.2015-03-05.zip=@/private/var/reconwise/emails/Newedge SGX T+1.2015-03-05/Newedge SGX T+1.2015-03-05.zip" localhost:8000/confo/upload/' | |
alias rpp='curl -F"Daily Statements 2015-02-25=@/private/var/reconwise/emails/Daily_Statements_2015-02-25.xls" localhost:8000/parser/parse/' | |
alias rpu='curl -F"Daily Statements 2015-03-16=@/tmp/test.csv" localhost:8000/parser/upload/' | |
alias rcp='curl -F"Daily Statements 2015-02-25=@/private/var/reconwise/emails/Daily_Statements_2015-02-25.xls" localhost:8000/confo/parse/' | |
alias rpu1='curl -F"Daily Statements 2015-03-16=@/tmp/test.csv" localhost:8000/confo/upload/' | |
alias rdi='curl -Fclient=1 -Fadapter=GH -F"delta_info.20150403.csv=@/private/var/reconwise/ftp/grasshopper-delta_info-20150403_060205.csv" -F"fields=hedge_ratio" -k https://tamtech.ddns.net/confo/relations/' | |
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
string strToSplit = "splitting strings, in|multiple ways"; | |
std::vector<std::string> words; | |
boost::split(words, strToSplit, boost::is_any_of("\t ,|")); | |
std::copy (words.begin(), words.end(), std::ostream_iterator<string>(cout, "\n")); | |
words.clear(); | |
std::istringstream iss(strToSplit); | |
std::copy(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(), std::back_inserter(words)); | |
std::copy (words.begin(), words.end(), std::ostream_iterator<string>(cout, "\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
template <class T1> | |
struct OuterStruct | |
{ | |
T1 mValue; | |
struct InnerStruct | |
{ | |
T1 mValue; | |
}; | |
}; |
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
git clone https://bitbucket.org/tildesg/reconwisev2.git | |
cd reconwisev2 | |
git fetch && git checkout ifastdemo | |
git pull | |
cd ../ | |
virtualenv -p python3.4 ve_rw2 | |
source ve_rw2/bin/activate | |
pip install -r reconwisev2/requirements.txt | |
cd reconwisev2/rw/ | |
mkdir media/log |
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
git log --oneline --shortstat | tee /tmp/2 | |
git log --shortstat --pretty="%cE" | sed 's/\(.*\)@.*/\1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/\1 0 insertions\(+\), \2/;s/\(\+\)$/\(\+\), 0 deletions\(-\)/;s/insertions?\(\+\), //;s/ deletions?\(-\)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;} {if ($1 != name && name != "") { print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net";}' > /tmp/1 & | |
git log --since="1 year ago" --pretty=tformat: --numstat | awk '{ if ( $2 != 0 && $1 != 0 ) print $0 }' | gawk '{ add += $1; s |
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/env python | |
# -*- coding: utf-8 -*- | |
from sqlsoup import SQLSoup as sql | |
from sys import argv | |
DIGRAPH = """digraph structs { | |
graph [ | |
rankdir= "LR" | |
bgcolor=white | |
] |