Skip to content

Instantly share code, notes, and snippets.

View kamikat's full-sized avatar

Kamikat kamikat

View GitHub Profile
@kamikat
kamikat / kasi.js
Last active August 29, 2015 13:57
clawer for kasi-time.com
// Usage: node kasi.js <id>
// Example:
// Get lyric from http://www.kasi-time.com/item-55961.html
// node kasi.js 55961
var http = require('http');
var vm = require('vm');
var no = process.argv[2];
@kamikat
kamikat / ajax.js
Created March 30, 2014 15:12
AJAX wrapper to jQuery's AJAX API to achieve a more scientific response handle framework
// @require `underscore` or `lodash`
// Figure out type of `obj'
var typeid = function (obj) {
return Object.prototype.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
};
var ajax = function (method, url, data, options, handler) {
if (typeid(options == 'function')) {
handler = options; options = {};
@kamikat
kamikat / sroller.bash
Last active August 29, 2015 13:59
Screen Rotation Script for Tablet PC (X220T)
#!/bin/bash
#
# Screen Rotation Script for Tablet PC (X220T)
#
# Usage:
# `rotator` - rotate screen clockwise to next orientation
# `rotator <orientation>` - rotate screen to orientation
# `<orientation>` can be
# xrandr style : normal,right,inverted,left
# xsetwacom style : none,cw,half,ccw
@kamikat
kamikat / smiledown.user.js
Last active August 29, 2015 14:01
Userscript for NICONICO(GINZA): add download link and axel download command generator after video title
// ==UserScript==
// @name Smile Download
// @namespace https://kirisetsz.github.io/
// @version 0.1.1
// @description Download video from Niconico (GINZA)
// @match http://www.nicovideo.jp/watch/*
// @copyright 2014, kirisetsz
// ==/UserScript==
var smile = function () {
@kamikat
kamikat / cookie-chrome.sh
Last active March 25, 2023 18:38
export curl cookie text from firefox and chrome on linux
@kamikat
kamikat / argparsing.js
Created June 17, 2014 16:30
Backward function argument parsing style...
module.exports = function (capture, handler, forceAll) {
var args = Array.prototype.slice.call(arguments, 0);
forceAll = args.pop();
if (typeof(forceAll) != 'boolean') {
handler = forceAll;
forceAll = true;
} else {
@kamikat
kamikat / receiver.py
Created June 18, 2014 02:37
Transfer file over LAN with file name broadcasted (Python)
#!/bin/env python
#-*- coding:utf-8 -*-
#Utility(
def rep(bytes):
bytes = float(bytes)
if bytes >= 1099511627776:
terabytes = bytes / 1099511627776
size = '%.2fT' % terabytes
@kamikat
kamikat / jetbrains-android-studio.desktop
Created June 29, 2014 10:07
Android Atudio desktop launcher file
[Desktop Entry]
Type=Application
Name=Android Studio
Categories=Development;Application;
Exec=/opt/android-studio/bin/studio.sh
Icon=/opt/android-studio/bin/androidstudio.ico
Terminal=false
@kamikat
kamikat / QiniuUploadRequest.java
Last active August 29, 2015 14:04
RoboSpice request uploading file to Qiniu CDN with upload progress notification
import com.octo.android.robospice.request.springandroid.SpringAndroidSpiceRequest;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
@kamikat
kamikat / ProgressCircle.java
Created July 28, 2014 06:18
Implement circle progress indicator view on android.
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
public class ProgressCircle extends View {