Skip to content

Instantly share code, notes, and snippets.

View okhiroyuki's full-sized avatar

Hiroyuki Okada okhiroyuki

View GitHub Profile
@chethann
chethann / WebviewResourceMappingHelper.java
Created November 24, 2017 09:19
WebviewResourceMappingHelper Sample Code
package com.test.android.helpers;
import android.os.Build;
import android.webkit.WebResourceResponse;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.test.android.Application;
import org.apache.commons.collections.CollectionUtils;
@TinkerTeam
TinkerTeam / How to Compile Debian Kernel for Tinker Board.md
Last active May 11, 2023 11:26
How to Compile Debian Kernel for Tinker Board

How to Compile Kernel for Tinker Board

- Build environment

Installing the build tools

sudo apt-get install git-core gitk git-gui gcc-arm-linux-gnueabihf device-tree-compiler gcc-aarch64-linux-gnu mtools parted libssl-dev

- Build Kernel

1. Compile the kernel

@bennadel
bennadel / test.js
Created March 2, 2017 13:05
Parsing And Serializing Large Objects Using JSONStream In Node.js
// Require the core node modules.
var chalk = require( "chalk" );
var fileSystem = require( "fs" );
var JSONStream = require( "JSONStream" );
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
@chethann
chethann / WebResourceResponse.java
Last active September 29, 2020 18:49
Sample code of WebResourceResponse to load WebView resources from local assets!
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String resourceUrl = request.getUrl().toString();
String fileExtension = WebviewResourceMappingHelper.getInstance().getFileExt(resourceUrl);
if(WebviewResourceMappingHelper.getInstance().getOverridableExtensions().contains(fileExtension)){
String encoding = "UTF-8";
String assetName = WebviewResourceMappingHelper.getInstance().getLocalAssetPath(resourceUrl);
if (StringUtils.isNotEmpty(assetName)) {
String mimeType = WebviewResourceMappingHelper.getInstance().getMimeType(fileExtension);
if (StringUtils.isNotEmpty(mimeType)) {
package jp.kogane.dev.prv.keystoretester;
import android.content.Context;
import android.security.KeyPairGeneratorSpec;
import android.support.annotation.NonNull;
import java.io.IOException;
import java.math.BigInteger;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
@shimakyohsuke
shimakyohsuke / wocker-site_move.md
Last active January 7, 2017 17:25
[FIX] Wocker を使って公開されているサイトをローカルにコピーする

※161102 以下記事に最新の方法が記載されてます。
http://blog.cntlog.net/?p=1494

  1. 公開サーバーの phpMyAdmin から生成オプションの「DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER コマンドを追加する」にチェックいれた状態で sql ファイルをエクスポート
  2. Wocker に新しいコンテナを作成 ※以下コマンドで作成したコンテナ名は「CONTAINER」です。
    core@wocker ~ $ wocker run --name CONTAINER
  3. wocker exec コマンドで root に入る
    core@wocker ~ $ wocker exec -it CONTAINER bash
  4. sql ファイルをインポート
    root@*****:/var/www/wordpress# wp db import --allow-root
@mmuszkow
mmuszkow / SignedJar.java
Last active May 24, 2022 06:35 — forked from mmm444/SimpleSignedJar.java
Signed JAR
package ch.cern.test.mdm.utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.Security;
@mmm444
mmm444 / SimpleSignedJar.java
Created October 21, 2013 16:42
dependencies: org.bouncycastle:bcpkix-jdk15on:1.49, com.google.guava:guava:15.0
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Security;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.List;
@orip
orip / JdkBasedTimeZoneProvider.java
Last active January 14, 2017 03:20
A Joda time zone provider based on the JVM's TimeZone implementation, instead of Joda's Olson database. This can reduce Joda's initialization time (during class loading) by several seconds on Android. Inspired by http://stackoverflow.com/a/6298241/37020, but implemented from scratch. Requires Guava, for ImmutableSet.
/*
* Copyright (C) 2013 Onavo Inc.
*
* 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
@zeha
zeha / gist:5999375
Created July 15, 2013 11:49
gitignore for MPLAB X projects
*.d
*.pre
*.p1
*.lst
*.sym
*.obj
*.o
*.sdb
*.obj.dmp
html/