BIOSの Config > Power > Sleep State を Windows 10 から Linux に変更する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.os.SystemClock | |
| import androidx.collection.LruCache | |
| import java.util.* | |
| /** | |
| * @param expireTime Cache expire time(ms). | |
| */ | |
| class ExpiringLruCache<K: Any, V: Any>(maxSize: Int, private val expireTime: Long) { | |
| private val cache: LruCache<K, V> = CustomLruCache(maxSize) | |
| private val expirationTimes: MutableMap<K, Long> = HashMap<K, Long>(maxSize) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.os.SystemClock | |
| /** | |
| * @param expireTime Cache expire time(ms). | |
| */ | |
| class ExpiringCache<V: Any>(private val expireTime: Long) { | |
| private var cache: V? = null | |
| private var expirationTime: Long = 0 | |
| fun get(): V? { |
BIOSの Config > Power > Sleep State を Windows 10 から Linux に変更する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| def lowpass(values, strength): | |
| result = [] | |
| f = 0 | |
| for v in values: | |
| if not result: | |
| result.append(v) | |
| f = v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| extension UIImage { | |
| func fixedOrientation() -> UIImage? { | |
| guard imageOrientation != UIImage.Orientation.up else { | |
| return self | |
| } | |
| guard let cgImage = self.cgImage else { | |
| return nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GlideApp.with(imageView.getContext()) | |
| .load(url) | |
| .into(new SimpleTarget<Drawable>() { | |
| @Override | |
| public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) { | |
| if (resource instanceof BitmapDrawable) { | |
| int width = ((BitmapDrawable) resource).getBitmap().getWidth(); | |
| int height = ((BitmapDrawable) resource).getBitmap().getHeight(); | |
| ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); | |
| layoutParams.width = width; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Bitmap getBitmap(@NonNull File file) { | |
| int exifRotation = getExifRotation(file); | |
| if (exifRotation != 0) { | |
| Matrix matrix = new Matrix(); | |
| matrix.postRotate(exifRotation); | |
| Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); | |
| if (!bitmap.isRecycled()) { | |
| bitmap.recycle(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.project.view.helper; | |
| import android.databinding.BindingAdapter; | |
| import android.graphics.drawable.Drawable; | |
| import android.support.annotation.ColorInt; | |
| import android.support.annotation.DrawableRes; | |
| import android.support.annotation.Nullable; | |
| import android.support.v4.content.ContextCompat; | |
| import android.support.v4.widget.SwipeRefreshLayout; | |
| import android.text.TextUtils; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'pathname' | |
| require 'rmagick' | |
| if ARGV.empty? | |
| puts 'Usage: convert9patch.rb [png]' | |
| exit | |
| end | |
| if !File.exist?(ARGV[0]) |
NewerOlder