Skip to content

Instantly share code, notes, and snippets.

@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 / ffmpeg.md
Created July 12, 2017 02:25 — forked from v5tech/ffmpeg.md
ffmpeg视频合并、格式转换、截图

使用ffmpeg合并MP4文件

ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "Apache Sqoop Tutorial Part 2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "Apache Sqoop Tutorial Part 3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "Apache Sqoop Tutorial Part 4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts|intermediate4.ts" -c copy -bsf:a aac_adtstoasc "Apache Sqoop Tutorial.mp4"
@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
@tzutalin
tzutalin / _readme.md
Created July 28, 2017 05:37 — forked from maxivak/_readme.md
Vagrant with Ubuntu 16.04 in VirtualBox

Setup Ubuntu 16.04 to be used with Vagrant and Virtualbox

Prepare Vagrant box with Ubuntu 16.04

We will use official box "ubuntu/xenial64" and modify it to work with Vagrant.

  • Vagrantfile
---
- name: Installl packages for localhost
hosts: "{{ cluster_name }}"
#hosts: all
become: true
tasks:
@tzutalin
tzutalin / nginxproxy.md
Created August 7, 2017 02:51 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@tzutalin
tzutalin / wifiadb.sh
Created November 1, 2017 08:11
Android Scripts
#!/bin/sh
# Author : tzu.ta.lin@gmail.com
# Copyright [2015] <tzu.ta.lin@gmail.com>
PORT=5555
if [ $# -ne 0 ]; then
while [ $# != 0 ]
do
PORT=$1
@tzutalin
tzutalin / iterm2-solarized.md
Created June 8, 2018 02:27 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k