On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that gives developers lossless compression. This package is commonly used for compressing release tarballs, software packages, kernel images, and initramfs images. It is very widely distributed, statistically your average Linux or macOS system will have it installed for
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
class EnumExample { | |
private enum Status { | |
Init, Success, Failed, Loading | |
} | |
public static enum ProcessStatus { | |
LOAD_STAGE(Status.Init), | |
END_STAGE(Status.Failed); | |
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 fun hopAnimation() { | |
val animation = bottomContainer | |
.animate() | |
.translationYBy(-40f) | |
.alpha(0.9f) | |
.setDuration(400) | |
animation.withEndAction { | |
bottomContainer | |
.animate() | |
.alpha(0.5f) |
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
// Generate data | |
int arraySize = 32768; | |
int data[] = new int[arraySize]; | |
Random rnd = new Random(0); | |
for (int c = 0; c < arraySize; ++c) | |
data[c] = rnd.nextInt() % 256; | |
// notice !!! | |
Arrays.sort(data); |
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
public class PhotoMultipartRequest<T> extends Request<T> { | |
private static final String FILE_PART_NAME = "file"; | |
private MultipartEntityBuilder mBuilder = MultipartEntityBuilder.create(); | |
private final Response.Listener<T> mListener; | |
private final File mImageFile; | |
protected Map<String, String> headers; |
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
public static int getMaxCodecInstanceByName(String name) { | |
final Vector<MediaCodec> codecs = new Vector<>(); | |
final MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, 1920, 1080); | |
MediaCodec codec = null; | |
for (int i = 0; i < max; i++) { | |
try { | |
codec = MediaCodec.createDecoderByType(MediaFormat.MIMETYPE_VIDEO_AVC); | |
codec.configure(format, null, null, 0); | |
codec.start(); |
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
/** | |
http://mythosil.hatenablog.com/entry/20111017/1318873155 | |
http://blog.dealforest.net/2012/03/ios-android-per-aes-crypt-connection/ | |
*/ | |
@interface NSData (AES) | |
- (NSData *)AES128EncryptedDataWithKey:(NSString *)key; | |
- (NSData *)AES128DecryptedDataWithKey:(NSString *)key; | |
- (NSData *)AES128EncryptedDataWithKey:(NSString *)key iv:(NSString *)iv; |
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
// consider about this url : http://sylvana.net/jpegcrop/exif_orientation.html | |
// you might consider when you get your image's exif information, | |
// check the orientation tag, it usually is 1, 3, 6, 8 | |
// So, rotate it. | |
BitmapFactory.Options options = new BitmapFactory.Options(); | |
options.inJustDecodeBounds = true; | |
BitmapFactory.decodeFile(path, options); |
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.text.format.DateUtils; | |
import android.util.FloatMath; | |
public class TwilightCalculator { | |
/** Value of {@link #mState} if it is currently day */ | |
public static final int DAY = 0; | |
/** Value of {@link #mState} if it is currently night */ | |
public static final int NIGHT = 1; | |
private static final float DEGREES_TO_RADIANS = (float) (Math.PI / 180.0f); |
The diff output is more specific:
[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.
>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.
NewerOlder