Skip to content

Instantly share code, notes, and snippets.

View kyawkyaw's full-sized avatar

Kyaw Kyaw Win kyawkyaw

View GitHub Profile
@kyawkyaw
kyawkyaw / generateAppIcon.sh
Created September 28, 2021 01:59 — forked from roblabs/generateAppIcon.sh
Generate app icons and xcassets file from a single image. To use this, place script in `appname` folder inside your project (i.e. the folder that Xcode generates for you containing your source code, it's named after whatever you called the app). Create folder there called `RawImages`. Source icon should 1024x1024 and be called appIcon.png. If th…
#!/bin/bash -e
# --------------------------------------------------------
# Generate app icons and xcassets file from a single image
# Ben Clayton, Calvium Ltd.
# https://gist.github.com/benvium/2be6d673aa9ac284bb8a
# --------------------------------------------------------
#
# Usage with an input of 1024x1024 PNG file
# generateAppIcon.sh AppIcon.png
@kyawkyaw
kyawkyaw / installing_cuda_on_azure_nc_tesla_k80_ubuntu.md
Created April 25, 2018 12:55 — forked from bzamecnik/installing_cuda_on_azure_nc_tesla_k80_ubuntu.md
Installing NVIDIA CUDA on Azure NC with Tesla K80 and Ubuntu 16.04
@kyawkyaw
kyawkyaw / JsonRestClient
Created January 31, 2018 09:51 — forked from Finkes/JsonRestClient
JSON REST Client for Unity 3D
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class JsonRestClient : MonoBehaviour {
private T fromJSON<T>(string json){
return JsonUtility.FromJson<T> (json);
}
@kyawkyaw
kyawkyaw / EndlessRecyclerOnScrollListener.java
Created January 17, 2016 04:13 — forked from imran0101/EndlessRecyclerOnScrollListener.java
RecyclerView position helper to get first and last visible positions
/**
* Custom Scroll listener for RecyclerView.
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessScrollListener";
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
@kyawkyaw
kyawkyaw / 1. Usage.md
Created December 18, 2015 09:00
How to track the progress of any OkHttp request body. Licence: MIT

How to track the progress of any OkHttp request body

Requires OkHttp >= 2.1.0 if you need to work with multipart request bodies. Lower versions don’t report the content length for the body, but the sum of the sizes of the parts is a pretty good approximation.

// TODO: Build a request body
RequestBody body = null;
@kyawkyaw
kyawkyaw / ffmpeg-configure-osx.sh
Created October 31, 2015 04:09 — forked from lalinsky/ffmpeg-configure-osx.sh
Configure static audio-only FFmpeg on OS X
#!/bin/sh
./configure \
--prefix=$PREFIX \
--enable-cross-compile \
--arch=$ARCH \
--target-os=darwin \
--cc="/usr/bin/gcc-4.0" \
--extra-ldflags="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch $ARCH" \
--extra-cflags="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch $ARCH" \
@kyawkyaw
kyawkyaw / update_xcode_plugins
Last active September 15, 2015 02:02 — forked from neonichu/update_xcode_plugins
Update DVTPlugInCompatibilityUUIDs for installed plugins from Xcode 5.1 beta to final
#!/bin/sh
#ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2
ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
1. The texture target needs to be GLES20.GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, e.g. in the glBindTexture calls and glTexParameteri calls.
2. In the fragment shader define a requirement to use the extension:
#extension GL_OES_EGL_image_external : require
3. For the texture sampler used in the fragment shader, use samplerExternalOES instead of sampler2D.
Everything below here is all in the C code, no more Java.
4. In the C code, use glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, eglImage) to specify where the data is, instead of using glTexImage2D family of functions.
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
//
// AMScanViewController.h
//
//
// Created by Alexander Mack on 11.10.13.
// Copyright (c) 2013 ama-dev.com. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>