Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / build-android-opencv.sh
Last active October 1, 2022 21:18
Build OpenCV for android
#!/usr/bin/env sh
NDK_ROOT="${1:-${NDK_ROOT}}"
if [ ! -d "${WD}/android-cmake" ]; then
echo 'Cloning android-cmake'
git clone https://github.com/taka-no-me/android-cmake.git
fi
### ABI setup
#ANDROID_ABI=${ANDROID_ABI:-"armeabi-v7a with NEON"}
@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 / timer-c++03.cpp
Last active March 11, 2023 12:25 — forked from gongzhitaao/CppTimer.md
Simple high resolution timer in C++
#include <iostream>
#include <ctime>
class Timer
{
public:
Timer() { clock_gettime(CLOCK_REALTIME, &beg_); }
double elapsed() {
clock_gettime(CLOCK_REALTIME, &end_);