Skip to content

Instantly share code, notes, and snippets.

@tzutalin
tzutalin / install_nv340_driver.sh
Last active April 30, 2016 16:07
Ubuntu14.04-nvidia-340 Driver installation
#!/bin/sh
# My GPU: Gefore710M
sudo apt-get remove nvidia* && sudo apt-get autoremove
sudo add-apt-repository -y ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install nvidia-340
# Install CUDA 6.0
sudo apt-get install nvidia-cuda-toolkit
# Install opencl
@tzutalin
tzutalin / opencl-headers.sh
Last active May 6, 2016 07:04 — forked from velenux/opencl-headers.sh
Download OpenCL headers
DIR=.
VERSION=12
echo "Downloading headers for version ${VERSION}..."
mkdir -p "${DIR}/CL-${VERSION}"
cd "${DIR}/CL-${VERSION}"
wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/opencl.h
@tzutalin
tzutalin / keytool-importkeypair
Last active July 5, 2016 02:40
android-signature.sh
#! /bin/bash
#
# This file is part of keytool-importkeypair.
#
# keytool-importkeypair is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# keytool-importkeypair is distributed in the hope that it will be
@tzutalin
tzutalin / update_upstream.sh
Created July 14, 2016 06:17
update_upstream.sh
#!/bin/sh
git remote add upstream $1
git fetch upstream
git pull --rebase upstream master
@tzutalin
tzutalin / run_flatc.py
Created August 2, 2016 12:37
run flatc
#!/usr/bin/env python
__author__ = 'TzuTaLin'
# Copyright (c) 2016 Tzutalin
# Create by TzuTaLin <tzu.ta.lin@gmail.com>
import os
import platform
import subprocess
@tzutalin
tzutalin / setup.sh
Last active August 3, 2016 05:35
Quick setup for Boost.Compute-Android
#!/usr/bin/env sh
# Clone Boost.Compute-Android
git clone --recursive https://github.com/tzutalin/Boost.Compute-Android
# Download NDK
wget https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
chmod +x android-ndk-r10e-linux-x86_64.bin
./android-ndk-r10e-linux-x86_64.bin 1> /dev/null 2>&1
mv android-ndk-r10e android-ndk
export PATH=`pwd`/android-ndk:$PATH
@tzutalin
tzutalin / semaphore.cpp
Last active May 3, 2017 06:55
Test flock
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/sem.h>
#include <unistd.h>
#include <sys/types.h>
@tzutalin
tzutalin / README.md
Created May 13, 2017 04:08 — forked from dnozay/README.md
simple distributed web crawler using flask + scrapy + redis

design

Requests are handled by flask, a bunch of urls are inserted in the object store (redis) and arguments are put on the queue (redis again) for workers to consume. More workers would mean more items processed in parallel.

Other possible implementations:

  • multiprocessing module for consuming all cpus.
  • multiprocessing.managers.SyncManager for distributing task to other machines.
@tzutalin
tzutalin / ubuntu16.sh
Last active July 30, 2017 00:33
VirtualBox
sudo apt-get update
sudo apt-get install -y virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
sudo apt-get -y install git
sudo apt-get -y install -y ant
sudo apt-get -y install g++
sudo apt-get -y install ipython
sudo apt-get -y install python2.7-dev python-pip
sudo apt-get -y install geany tree meld
---
- name: Installl packages for localhost
hosts: "{{ cluster_name }}"
#hosts: all
become: true
tasks: