This file contains hidden or 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/sh | |
tar -xzvf eclipse*.tar.gz -C /opt | |
chmod -R +r /opt/eclipse | |
# use the technique "HERE document" | |
# http://tldp.org/LDP/abs/html/here-docs.html | |
(cat <<'EOF' | |
#!/bin/sh | |
export ECLIPSE_HOME="/opt/eclipse" | |
$ECLIPSE_HOME/eclipse $* |
This file contains hidden or 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 bash | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains hidden or 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/sh | |
# this script does absolutely ZERO error checking. however, it worked | |
# for me on a RHEL 6.3 machine on 2012-08-08. clearly, the version numbers | |
# and/or URLs should be made variables. cheers, [email protected] | |
mkdir mosh | |
cd mosh |
This file contains hidden or 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
import shlex, subprocess | |
raw_args = "sqlcmd -S cypress.csil.sfu.ca -d cmpt354_bank -i %s.sql"%(test) | |
args = shlex.split(raw_args) | |
output = subprocess.check_output(args) | |
print output |
This file contains hidden or 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
DECLARE @Query1Checksum bigint | |
DECLARE @Query2Checksum bigint | |
Use Northwind354 | |
-- Get checksum from source query | |
Select @Query1Checksum = CHECKSUM_AGG(BINARY_CHECKSUM(*)) | |
FROM | |
( | |
-- [Start Source Query] | |
SELECT O.OrderID, O.OrderDate, |
This file contains hidden or 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 <iostream> | |
using namespace std; | |
class Base{ | |
public: | |
virtual ~Base() { | |
cout << "Base Destruct" << endl; | |
} | |
virtual void print(){ | |
cout << "Base" << endl; |
This file contains hidden or 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
clock_t start, end; | |
start = clock(); | |
// | |
// YOUR CODE | |
// | |
end = clock(); | |
cerr << "Inverted Index is built in " |
This file contains hidden or 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 your Mac hostname with the command line and make it permanent: | |
sudo scutil –-set HostName new_hostname |
This file contains hidden or 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
# generate combinations | |
# | |
# http://docs.python.org/2/library/itertools.html#itertools.combinations | |
# | |
# combinations(iterable, r) --> combinations object | |
# Return successive r-length combinations of elements in the iterable. | |
combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3) |
This file contains hidden or 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
// top k denest regions: the k-th region is on the top | |
class RegionCmp { | |
public: | |
bool operator()(const Region& lhs, const Region& rhs) const { | |
return lhs.d > rhs.d; | |
} | |
}; | |
typedef priority_queue<Region, vector<Region>, RegionCmp> RegionPQ; |