Skip to content

Instantly share code, notes, and snippets.

@zinwalin
zinwalin / UInt_extension.swift
Created April 27, 2022 08:31 — forked from kimjj81/UInt_extension.swift
Convert UInt to UInt8(byte) Array in swift.
protocol UIntToBytesConvertable {
var toBytes: [UInt8] { get }
}
extension UIntToBytesConvertable {
func toByteArr<T: BinaryInteger>(endian: T, count: Int) -> [UInt8] {
var _endian = endian
let bytePtr = withUnsafePointer(to: &_endian) {
$0.withMemoryRebound(to: UInt8.self, capacity: count) {
UnsafeBufferPointer(start: $0, count: count)
@zinwalin
zinwalin / BytesPlayground.swift
Created April 26, 2022 08:18 — forked from brennanMKE/BytesPlayground.swift
Copy bytes from Data with Swift
import Foundation
let size = MemoryLayout<Int16>.stride
let data = Data(bytes: [1, 0, 2, 0, 3, 0]) // little endian for 16-bit values
let int16s = data.withUnsafeBytes { (bytes: UnsafePointer<Int16>) in
Array(UnsafeBufferPointer(start: bytes, count: data.count / size))
}
let length = data.count * MemoryLayout<Int16>.stride
@zinwalin
zinwalin / gist:b13db49a5720be6b71d1c1f732fdb056
Created April 25, 2022 07:58 — forked from albertodebortoli/gist:2204433
Copy file from bundle to documents directory in iOS
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.filename = @"file.ext";
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentDir = [documentPaths objectAtIndex:0];
self.filePath = [documentDir stringByAppendingPathComponent:self.filename];
[self createAndCheckDatabase];
@zinwalin
zinwalin / gist:005ae66a24cf07d82535ad9ae2722e70
Created April 19, 2022 13:52 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
pm list packages -f
@zinwalin
zinwalin / gist:5c37a6a1c745989ae5b9ff1fd1361b8a
Created April 11, 2022 01:58 — forked from romanbb/gist:8011102
compile, push, and start SystemUI.apk
#!/bin/bash
. build/envsetup.sh
mmm frameworks/base/packages/SystemUI/
adb start-server
adb shell pkill -TERM -f com.android.systemui
adb remount
adb push $OUT/system/priv-app/SystemUI.apk /system/priv-app/SystemUI.apk
adb shell pkill -TERM -f com.android.systemui
adb shell chmod 0644 /system/app-priv/SystemUI.apk
sleep 2
# Unreal Engine file types.
*.uasset filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text
# Raw Content file types.
*.fbx filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
@zinwalin
zinwalin / bitbucket-pipelines.yml
Created January 24, 2022 14:34 — forked from szilagyiabo/bitbucket-pipelines.yml
Example Bitbucket Pipeline for Vue.js application
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:8.12.0
pipelines:
branches:
@zinwalin
zinwalin / helm-values.yaml
Created January 24, 2022 14:31 — forked from axdotl/helm-values.yaml
Helm example values for stable/jenkins v1.1.17
master:
useSecurity: true
adminUser: "admin"
fsGroup: 1000
runAsUser: 1000
serviceType: ClusterIP
installPlugins:
@zinwalin
zinwalin / android-version-and-tag-automation.sh
Created December 31, 2021 06:22 — forked from drilonrecica/android-version-and-tag-automation.sh
Bash script for automating versioning (versionCode & versionName) and setting git Tag in an android project
# Proccess:
# 1. Go into app directory
# 2. Get current versionCode and print it
# 3. Increment versionCode by one and print it
# 4. Get current versionName and print it
# 5. Ask user for new versionName and set it then print it
# 6. Stage changes to build.gradle
# 7. Go back one directory to project root
# 8. Commit version update with message Bumped up version
# 9. Tag with versionName
@zinwalin
zinwalin / get_sdl.sh
Created December 27, 2021 06:35 — forked from logbase2/get_sdl.sh
Build script for building SDL2 and extensions for iOS, tvOS and macOS
#!/bin/bash
#
# usage: Make executable and type ./get_sdl.sh
#
# Note - Use -showBuildSettings such as:
# xcodebuild -configuration Release HEADER_SEARCH_PATHS="../../SDL/include/ ./Frameworks/FreeType.framework/Headers/" -target "Static Library" -arch x86_64 -sdk macosx -showBuildSettings
# to list all build settings...
#
# Note - Had to update the HEADER_SEARCH_PATHS and MACOSX_DEPLOYMENT_TARGET for
# a couple of libraries for the macOS versions. The HEADER_SEARCH_PATHS were set to look