Skip to content

Instantly share code, notes, and snippets.

View rayworks's full-sized avatar
🌎

rayworks rayworks

🌎
  • Shanghai, China
  • 02:58 (UTC +08:00)
View GitHub Profile
@tibo
tibo / org.jenkins-ci.jenkins.plist
Created February 7, 2011 01:37
Jenkins Launchd configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UserName</key>
<string>jenkins</string>
<key>Label</key>
<string>org.jenkins-ci.jenkins</string>
<key>EnvironmentVariables</key>
<dict>
@icodeforlove
icodeforlove / mp4-chunk-test.js
Created September 18, 2012 22:57
Simple file server test for video
/*jshint node:true*/
var fs = require('fs'),
http = require('http'),
path = require('path'),
port = 1338,
dir = '.';
http.createServer(function (request, response) {
var filePath = path.join(dir, path.basename(request.url));
if (path.extname(request.url) !== '.mp4' || !fs.existsSync(filePath)) return throw404();
@arriolac
arriolac / TopCropImageView.java
Last active March 21, 2023 08:01
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@mpost
mpost / Entry.java
Created September 18, 2013 11:50
Android application demonstrating the usage of ViewOverlay and OnPreDrawListener to achieve animations effects.
package com.example.overlay;
public class Entry {
private final int imageResId;
private final String title;
public Entry( int imageResId, String title ) {
this.imageResId = imageResId;
@staltz
staltz / introrx.md
Last active June 7, 2024 23:39
The introduction to Reactive Programming you've been missing
@cyndibaby905
cyndibaby905 / build_ffmpeg_android
Created August 5, 2014 07:14
Build ffmpeg on OS X 10.9
此处主要参考 http://harryhsu.logdown.com/posts/198416-build-ffmpeg-on-mac-os-109
根据我的编译过程做了适当修改
1. Download NDK
https://developer.android.com/tools/sdk/ndk/index.html
我下载的版本是android-ndk-r10,不同的版本在下面的build脚中本需要修改的地方大致相同.
2. Download ffmpeg source code
下载 ffmpeg(http://www.ffmpeg.org/download.html)
推荐 git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
@eduardb
eduardb / CountingFileRequestBody.java
Last active May 26, 2023 00:07
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@moondroid
moondroid / GrayScale.java
Created March 12, 2015 09:15
Transform Bitmap to grayscale
public static Bitmap toGrayScale(Bitmap bmpOriginal) {
int width, height;
height = bmpOriginal.getHeight();
width = bmpOriginal.getWidth();
Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bmpGrayscale);
Paint paint = new Paint();
ColorMatrix cm = new ColorMatrix();
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active May 27, 2024 22:57
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@renshuki
renshuki / ubuntu_agnoster_install.md
Last active May 25, 2024 06:37
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH