Skip to content

Instantly share code, notes, and snippets.

View kamikat's full-sized avatar

Kamikat kamikat

  • Beijing, China
View GitHub Profile
@kamikat
kamikat / ImageThumbnailRequest.java
Last active August 29, 2015 14:04
RoboSpice image thumbnail request handling EXIF data of input file
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.media.ExifInterface;
import java.io.File;
@kamikat
kamikat / qrdec.sh
Created August 9, 2014 06:04
Decode BarCode/QRCode image file using ZXing online decoder
#!/bin/sh
curl -s -F f=@$1 http://zxing.org/w/decode |
grep -P -o "(?=<pre[^>]*>).*(?=</pre>)" |
grep -P -o "(?<=>).*$" |
uniq
@kamikat
kamikat / journal.js
Created August 18, 2014 04:54
A node.js server module generating xlsx file using elxml.
var _ = require('lodash');
var path = require('path');
var moment = require('moment');
var request = require('superagent');
var excel = require('elxml');
var conf = require('../../configure');
var upstream = conf.upstream;
var baseuri = 'http://' + upstream.host + ':' + upstream.port;
@kamikat
kamikat / EnhancedFormHttpMessageConverter.java
Created August 30, 2014 02:42
Clone of FormHttpMessageConverter from Spring Android REST Template Library. The converter will calculate the size of request body and set Content-Length header before writing data to the OutputStream.
package com.tietie.foundation.io.core;
import org.apache.commons.io.output.CountingOutputStream;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
@kamikat
kamikat / trig.scss
Last active March 18, 2025 20:24
SCSS/SASS module calculating sin/cos/tan using Taylor Expansion.
///////////////////////////////////////////////////////////
// Plain SASS Trigonometry Algorithm in Taylor Expansion //
// //
// Based on //
// http://japborst.net/posts/sass-sines-and-cosines //
///////////////////////////////////////////////////////////
$pi: 3.14159265359;
$_precision: 10;
@kamikat
kamikat / MaskView.java
Last active August 29, 2015 14:06
Evil implementation to rounded corner containers.
package com.tietie.foundation.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@kamikat
kamikat / sshtunnel
Last active August 29, 2015 14:07
Systemd simple session-level SSH Tunnel Service
#!/bin/bash
_KEY=$1
shift 1
if [ -z "$SSH_AUTH_SOCK" ]
then
SSH_AUTH_SOCK=`ss -xl | grep -o "/run/user/$UID/keyring-.*/ssh"`
if [ -z "$SSH_AUTH_SOCK" ]
@kamikat
kamikat / merger.bash
Created October 4, 2014 09:37
Bash script rename & merge Android image slices into project's resource root.
#!/bin/bash
MAP_FILE=$1
SEARCH_ROOT=$2
DESTINATION_ROOT=$3
cat $MAP_FILE | grep -v '^$' | (
while read DESTINATION_NAME SOURCE_NAME
do
SAVEIFS=$IFS
@kamikat
kamikat / AndroidBug5497WorkaroundSupportingTranslucentStatus.java
Created October 11, 2014 10:16
AndroidBug5497Workaround supporting translucent status window attribute
package com.tietie.foundation.util;
import android.app.Activity;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.FrameLayout;
@kamikat
kamikat / zerochan_feedly_helper.user.js
Created October 12, 2014 18:44
Zerochan Blacklisted Feed Killer - Auto-hide feeds from feedly blacklisted by zerochan.net
// ==UserScript==
// @name Zerochan Blacklisted Feed Killer
// @version 0.0.1
// @description Auto-hide feeds from feedly blacklisted by zerochan.net
// @include https://feedly.com/*
// @include http://feedly.com/*
// @run-at document-end
// @namespace https://github.com/kirisetsz
// ==/UserScript==