Skip to content

Instantly share code, notes, and snippets.

View miurahr's full-sized avatar

Hiroshi Miura miurahr

View GitHub Profile
@miurahr
miurahr / build.gradle.kts
Created October 13, 2022 23:05
FatJar with gathering subprojects
tasks.jar {
subprojects.forEach { subproject ->
from(subproject.configurations.compileClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) })
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
@miurahr
miurahr / test_stream_compressor.py
Last active August 9, 2020 02:38
pytest stream compression/decompression
import hashlib
import io
import lzma
import os
import pathlib
from typing import Optional, Union
import zstandard
from Crypto.Cipher import AES
@miurahr
miurahr / compress_stream.py
Created August 7, 2020 02:44
Combine legacy API with stream API for compression
import hashlib
import io
import lzma
import zstandard
import os
from Crypto.Cipher import AES
class FilterStream(io.RawIOBase):
@miurahr
miurahr / effective_modern_cmake.md
Last active July 9, 2018 06:43
Effective Modern CMake
# Description:
# Log all the things to ElasticSearch then lets you ask hubot what you missed
#
# Dependencies:
# None
#
# Configuration:
# ELASTICSEARCH_HOSTNAME - E.G. elasticsearch.example.com:9200, where to send the put requests
# ELASTICSEARCH_USERNAME - OPTIONAL basic auth username
# ELASTICSEARCH_PASSWORD - OPTIONAL basic auth password
@miurahr
miurahr / nginx_req_limit.conf
Created January 18, 2015 14:50
limit tile request on nginx
http {
limit_req_zone $binary_remote_addr zone=tile_req:20m rate=16r/s;
...
server {
...
location / {
@miurahr
miurahr / gist:86fe3d1a3e68e290dca2
Created October 2, 2014 07:52
Force standard view (not compatible one) with IE and Nginx
Enable Module ngx_http_browser_module
if ($msie) {
add_header 'X-UA-Compatible' 'IE=Edge,chrome=1';
}
@miurahr
miurahr / gpsstatus_notify.java
Created August 2, 2014 23:38
IGpsStatusListener.aidl sample
/*
* propergate Satelllites in View changes to clients
* through
* .onSvStatusChanged(int svCount, int[] prns, float[] snrs,
* float[] elevations, float[] azimuths, int ephemerisMask,
* int almanacMask, int usedInFixMask);
*
*
*/
private void notifySatellites(){
@miurahr
miurahr / util.java
Created August 2, 2014 23:37
convert ArrayList<Integer> to int[]
public static int[] convertIntegers(List<Integer> integers){
int[] ret = new int[integers.size()];
Iterator<Integer> iterator = integers.iterator();
for (int i = 0; i < ret.length; i++)
{
ret[i] = iterator.next().intValue();
}
return ret;
}
@miurahr
miurahr / BluetoothGpsMockProvider.java
Created July 26, 2014 04:17
bluegps4droid refactoring snipet
/*
* Copyright (C) 2010, 2011, 2012 Herbert von Broeuschmeul
* Copyright (C) 2010, 2011, 2012 BluetoothGPS4Droid Project
*
* This file is part of BluetoothGPS4Droid.
*
* BluetoothGPS4Droid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.