Skip to content

Instantly share code, notes, and snippets.

View kamikat's full-sized avatar

Kamikat kamikat

View GitHub Profile
@kamikat
kamikat / onedrive.user.js
Last active August 29, 2015 13:55
不可視境界線を示す! Permanent external links from skydrive, useful to share links with friends or apply as source for image/audio
// ==UserScript==
// @name OneDrive External Links Button
// @namespace https://kirisetsz.github.io/
// @version 0.1
// @description 不可視境界線を示す! Permanent external links from skydrive, useful to share links with friends or apply as source for image/audio
// @match https://onedrive.live.com/*
// @copyright 2014, kirisetsz
// ==/UserScript==
var sekai = function () {
@kamikat
kamikat / wc.c
Created March 21, 2014 06:09
咱这是多久没写 C 了……
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER_SIZE (1024)
int main (int argc, char **argv) {
int flags = 0;
char* path = NULL;
@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 / 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 / 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 / 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;