Skip to content

Instantly share code, notes, and snippets.

@mattli001
mattli001 / Makefile
Last active April 21, 2018 02:07
A Makefile based CI/CD chain for Go
# http://le-gall.bzh/post/makefile-based-ci-chain-for-go/
SHELL := $(shell which bash) # set default shell
# OS / Arch we will build our binaries for
OSARCH := "linux/amd64 linux/386 windows/amd64 windows/386 darwin/amd64 darwin/386"
ENV = /usr/bin/env
.SHELLFLAGS = -c # Run commands in a -c flag
.SILENT: ; # no need for @
.ONESHELL: ; # recipes execute in same shell
.NOTPARALLEL: ; # wait for this target to finish
@mattli001
mattli001 / x64 python
Created March 5, 2018 06:33 — forked from verybada/x64 python
CC-2193, x64 toolchain
# CC-2193, x64 toolchain
# TODO
1. shall we still need to support x86_es
2. Why there is still .pyc in python-lib
# Prepare necessary libraries
* There is no third-party libraries in x64 toolchain (libssl, libcrypto ...)
1. Build x64 library first
```
> @NasX86/Model/TS-X51
@mattli001
mattli001 / gist:bd4839cb19a75694964e986d8ba6ee1e
Created February 7, 2018 02:32
Galaxy 17.09 run.sh log
Initializing config/migrated_tools_conf.xml from migrated_tools_conf.xml.sample
Initializing config/shed_tool_conf.xml from shed_tool_conf.xml.sample
Initializing config/shed_tool_data_table_conf.xml from shed_tool_data_table_conf.xml.sample
Initializing config/shed_data_manager_conf.xml from shed_data_manager_conf.xml.sample
Initializing tool-data/shared/ucsc/builds.txt from builds.txt.sample
Initializing tool-data/shared/ucsc/manual_builds.txt from manual_builds.txt.sample
Initializing static/welcome.html from welcome.html.sample
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in .venv/bin/python2.7
Also creating executable in .venv/bin/python
@mattli001
mattli001 / ubuntu-eol.md
Created January 4, 2018 01:30 — forked from dergachev/ubuntu-eol.md
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]
diff --git a/Makefile.pre.in b/Makefile.pre.in
index bcd83bf..efbfd8d 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -461,6 +461,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
esac; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
FROM ubuntu:16.04
LABEL maintainer caffe-maint@googlegroups.com
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
unzip \
libatlas-base-dev \
FROM armv7/armhf-ubuntu
RUN apt-get update && apt-get -y upgrade && apt-get install -y build-essential cmake git pkg-config libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev
RUN apt-get install -y --no-install-recommends libboost-all-dev
RUN apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
# (Python general)
RUN apt-get install -y python-pip
[~] # docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9d925e70b634 bmwshop/caffe-rpi:latest "/bin/bash" 39 minutes ago Up 38 minutes caffe-rpi-1
[~] # docker exec -ti caffe-rpi-1 bash -c "make run test"
root@9d925e70b634:/caffe# pwd
/caffe
root@9d925e70b634:/caffe# make runtest
.build_release/tools/caffe
caffe: command line brew
usage: caffe <command> <args>
@mattli001
mattli001 / ffmpeg_test.go
Created May 19, 2017 01:56
golang test ffmpeg example
package ffmpeg
import (
"bytes"
"context"
"io"
"os"
"os/exec"
"strings"
"testing"
@mattli001
mattli001 / calc_downsize.go
Created April 13, 2017 10:09
calc downsize of video resolution
package main
import "fmt"
// Calculates scaling factors using old and new image dimensions.
func calcFactors(width, height uint, oldWidth, oldHeight float64) (scaleX, scaleY float64) {
if width == 0 {
if height == 0 {
scaleX = 1.0
scaleY = 1.0