Skip to content

Instantly share code, notes, and snippets.

# 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 / 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
@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: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 / 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 / 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 / DataExtensions.swift
Created April 27, 2022 08:32 — forked from bpolania/DataExtensions.swift
Swift Extensions for Data, Int, UInt8, UInt16, and UInt32 types
// MIT License
// Copyright (c) 2018 Boris Polania
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@zinwalin
zinwalin / crc32.swift
Created April 28, 2022 06:06 — forked from MaddTheSane/crc32.swift
crc32 implemented in Swift
//
// crc32.swift
// SuperSFV
//
// Created by C.W. Betts on 8/23/15.
//
//
/* crc32.swift -- compute the CRC-32 of a data stream
Copyright (C) 1995-1998 Mark Adler
Copyright (C) 2015 C.W. "Madd the Sane" Betts
@zinwalin
zinwalin / CRC32.swift
Created April 28, 2022 06:14 — forked from antfarm/CRC32.swift
CRC32 checksum generation in a few lines of Swift 5. https://en.wikipedia.org/wiki/Cyclic_redundancy_check#CRC-32_algorithm
class CRC32 {
static var table: [UInt32] = {
(0...255).map { i -> UInt32 in
(0..<8).reduce(UInt32(i), { c, _ in
(c % 2 == 0) ? (c >> 1) : (0xEDB88320 ^ (c >> 1))
})
}
}()
@zinwalin
zinwalin / postman-pre-request.js
Created June 7, 2022 12:53 — forked from bcnzer/postman-pre-request.js
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',