Skip to content

Instantly share code, notes, and snippets.

@arkty
arkty / BoundaryTest.java
Created August 13, 2014 04:48
android-async-http
private void multipartBoundaryMissed() throws IOException {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "tempfile.dmp");
file.createNewFile();
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("access_token", "AFVVD");
params.put("file", file);
@arkty
arkty / BluetoothHelper.java
Created September 9, 2014 09:42
Bluetooth helper
public static final UUID RFCOMM_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
public static BluetoothSocket createSocket(BluetoothDevice device) throws IOException {
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD) {
return createSocketPostGingerbread(device);
}
else {
return createSocketPreGingerbread(device);
}
}
private boolean isPointInRange(double latitude, double longitude, List<GeoPoint> range) {
int i, j;
boolean c = false;
int nvert = range.size();
for (i = 0, j = nvert-1; i < nvert; j = i++) {
GeoPoint jPoint = range.get(j);
GeoPoint iPoint = range.get(i);
if ( ((iPoint.Longitude >longitude) != (jPoint.Longitude>longitude)) &&
(latitude < (jPoint.Latitude-iPoint.Latitude) * (longitude-iPoint.Longitude) / (jPoint.Longitude-iPoint.Longitude) + iPoint.Latitude))
c = !c;
<!-- /usr/share/themes/elementary/metacity-1/metacity-theme-3.xml -->
<frame_geometry name="max" has_title="false" title_scale="medium" parent="normal" rounded_top_left="false" rounded_top_right="false">
<distance name="left_width" value="0" />
<distance name="right_width" value="0" />
<distance name="left_titlebar_edge" value="0"/>
<distance name="right_titlebar_edge" value="0"/>
<distance name="title_vertical_pad" value="0"/>
<border name="title_border" left="0" right="0" top="0" bottom="0"/>
<border name="button_border" left="0" right="0" top="0" bottom="0"/>
<distance name="bottom_height" value="0" />
@arkty
arkty / CurlLoggingInterceptor.java
Created January 19, 2016 08:01 — forked from jgilfelt/CurlLoggingInterceptor.java
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@arkty
arkty / TileSticher.cs
Created February 9, 2016 18:12 — forked from praeclarum/TileSticher.cs
Downloads and stitches map tiles
using System;
using System.Net;
using System.IO;
using Gdk;
namespace TileSticher
{
class App
{
public static int Main (string[] args)
@arkty
arkty / ingress-intel-notify-ui.user.js
Created February 15, 2016 17:21 — forked from arantius/ingress-intel-notify-ui.user.js
User script for the Ingress Intel dashboard / notifier
// ==UserScript==
// @name Ingress Intel: Notify UI
// @namespace https://arantius.com/misc/greasemonkey/
// @description Annotate the Ingress Intel Dashboard with links to control the Ingress Notify app.
// @match http://www.ingress.com/intel*
// @version 1
// @grant none
// ==/UserScript==
//const NOTIFY_SERVER = 'http://localhost:8080/'
package me.arkty.views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.FrameLayout;
/**
* Author: Andrey Khitryy
* Email: andrey.khitryy@gmail.com
@arkty
arkty / HClust_Dendogram.R
Created June 10, 2016 18:11 — forked from jamesthomson/HClust_Dendogram.R
R HClust to d3.js Dendogram
library(rjson)
#convert output from hclust into a nested JSON file
HCtoJSON<-function(hc){
labels<-hc$labels
merge<-data.frame(hc$merge)
for (i in (1:nrow(merge))) {
package com.example.beginner1;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;