Here are my solutions to all SQL problems on leetcode.
-- how to do rank with out window function
select t1.category, count(distinct t2.id) as dense_rank
from table t1, table t2
where t1.id = t2.id and t1.value <= t2.value
group by t1.category
import boto3 | |
def get_s3_object(key, bucket_name, | |
object_component='Body', | |
region_name='us-east-1', | |
encoding='utf-8'): | |
""" | |
Method to read s3 file directly in meomory | |
:param key: key of the file on s3 bucket | |
:param bucket_name: the s3 bucket name |
make_wheel: | |
python setup.py bdist_wheel --universal | |
package_cloud push vevo/common/python ./dist/`ls dist` | |
container_make_wheel: | |
docker build --build-arg pc_config='${PC_CONFIG}' \ | |
-t vevo/vevoml-build . | |
docker run -it --entrypoint make vevo/vevoml-build make_wheel |
Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112
For older versions of Spark and ipython, please, see also previous version of text.
hexo clean | |
hexo generate | |
cp -R public/* .deploy/your_githubname.github.io | |
cd .deploy/your_githubname.github.io | |
git add . | |
git commit -m "update" | |
git push -f origin master | |
cd ../../ |
echo "Please enter your github name: " | |
read github_name | |
git_link="https://github.com/$github_name/$github_name.github.io.git" | |
git clone $git_link .deploy/$github_name.github.io | |
cd .deploy/$github_name.github.io | |
git pull | |
cd ../../ |
# install NodeJS | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash | |
nvm install stable | |
# install hexo | |
npm install -g hexo-cli | |
# initialize | |
echo "Please enter your github name: " | |
read github_name |
git checkout --orphan latest_branch | |
git add -A | |
git commit -am "initial commit" | |
git branch -D master | |
git branch -m master | |
git push -f origin master |
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git |
#!/usr/bin/env sh | |
echo "Stuff I do after a fresh xubuntu install:" | |
echo "" | |
echo "Installing f.lux" | |
sudo add-apt-repository ppa:kilian/f.lux | |
sudo apt-get update | |
echo "Installing all my favorite applications" | |
sudo apt-get -y install fluxgui python-pip git-core gitg gedit gedit-plugins gparted bleachbit gnome-do lightread chromium-browser zsh | |
echo "Removing unwanted applications" | |
sudo apt-get -y remove firefox |