Skip to content

Instantly share code, notes, and snippets.

@rsky
rsky / file0.java
Last active May 2, 2016 09:17
RetrofitでMediaStoreから取得したオブジェクトをアップロードする ref: http://qiita.com/rsky/items/fbe0b5fdfa955b8026a9
public interface UploadService {
@Multipart
@POST("/upload")
Observable<Response> upload(@Part("file") TypedFile file);
}
@rsky
rsky / resize-assets.sh
Created July 30, 2015 05:43
@3xイメージから各種サイズに変換するシェルスクリプト 9-patch化も
#!/bin/sh
mkdir -p drawable-mdpi drawable-hdpi drawable-xhdpi drawable-xxhdpi
for name in foo bar; do
convert -resize 216x116 "${name}@3x.png" "${name}@2x.png"
convert -resize 162x87 "${name}@3x.png" "${name}@1.5x.png"
convert -resize 108x58 "${name}@3x.png" "${name}.png"
convert "${name}@3x.png" -background transparent -gravity northeast -splice 1x1 tmp.png
convert tmp.png -background transparent -gravity southwest -splice 1x1 "drawable-xxhdpi/${name}.9.png"
@rsky
rsky / file0.txt
Created June 24, 2015 02:15
bundle installでnokogiriがビルドエラーになったら ref: http://qiita.com/rsky/items/12a573f4288918689807
-----
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
-----
@rsky
rsky / PlistVersioning.sh
Created June 16, 2015 08:22
CFBundleVersionにビルドのタイムスタンプを追加する
#!/bin/bash
plistBuddy="/usr/libexec/PlistBuddy"
infoPlistFileSource="${SRCROOT}/${INFOPLIST_FILE}"
infoPlistFileDestination="${TEMP_DIR}/Preprocessed-Info.plist"
currentVersion=$($plistBuddy -c "Print CFBundleVersion" $infoPlistFileSource)
timeStamp=$(date '+%s')
versionString="$currentVersion.$timeStamp"
$plistBuddy -c "Set :CFBundleVersion $versionString" $infoPlistFileDestination
import subprocess
from logbook.data import DataType
def osx_notify(message):
subprocess.call(('/opt/local/bin/terminal-notifier', '-message', message))
desktop_notify = osx_notify
@rsky
rsky / dgcw.py
Last active August 29, 2015 14:16
.apk/.ipaをDeployGateにアップロード、配布ページをChatWorkで通知する
# -*- coding:utf-8 -*-
"""
.apk/.ipaをDeployGateにアップロード、配布ページをChatWorkで通知する
"""
from __future__ import unicode_literals
from __future__ import print_function
from argparse import ArgumentParser
import os
import requests
@rsky
rsky / reconnaissance.py
Last active August 29, 2015 14:12
Reconnaissance Calculator
# -*- coding:utf-8 -*-
import math
class Fleet(object):
level = 0
ships = []
def __init__(self, level, *ships):
self.level = level
@rsky
rsky / export_reverse.py
Created February 22, 2014 07:56
Export Django's django.core.urlresolvers.reverse as JavaScript and CoffeeScript
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
import re
from optparse import make_option
from collections import OrderedDict
from django.core.urlresolvers import get_urlconf, get_resolver
prefix="/opt/local"
exec_prefix="/opt/local"
libdir="/opt/local/lib"
includedir="/opt/local/include/openjpeg-2.0"
Name: OpenJPEG
Description: Open-source C-Library for JPEG 2000
Version: 2.0.0
Requires:
Libs: -L${libdir} -lopenjp2
@rsky
rsky / CMakeLists.txt
Last active December 19, 2015 00:19 — forked from anonymous/CMakeLists.txt
CMakeLists.txt for jxrlib 1.1.0 https://jxrlib.codeplex.com/
cmake_minimum_required(VERSION 2.8.8)
project(jxrlib)
set(jxrlib_VERSION 1.1.0)
set(jxrlib_SOVERSION 1)
set(bindir bin)
set(incdir include)
set(libdir lib)
set(CMAKE_SKIP_BUILD_RPATH OFF)