Skip to content

Instantly share code, notes, and snippets.

View osamaqarem's full-sized avatar

Osama Qarem osamaqarem

View GitHub Profile
@osamaqarem
osamaqarem / HPomen.md
Last active November 11, 2018 08:28
Ubuntu Setup for HP Omen

Ubuntu 18.04 on HP OMEN 15-CE032TX

Software to install

deluge tlp psensor intel-microcode alsamixer pavucontrol gnome-tweaks dconf-editor grub-customizer pixel-saver powertop

Workflow/Troubleshooting

@osamaqarem
osamaqarem / svn.md
Last active March 31, 2020 04:11
SVN for Git Users

Add all files

svn add --force * --auto-props --parents --depth infinity -q

Remove all files

svn revert * --depth infinity -q

Edit svn:global-ignore for current directory

(Easiest. Ignores must be set on parent directory)

@osamaqarem
osamaqarem / decode.js
Last active April 22, 2020 03:05
Decode Base64 Image in Browser Console
function decode(imageString){
var image = new Image();
image.src = `data:image/png;base64,${imageString}`;
document.body.replaceWith(image);
}
@osamaqarem
osamaqarem / .sh
Last active April 14, 2020 10:09
ADB Remote
# Connect device over USB
# Get device IP
adb shell ip -f inet addr show wlan0
# Define port
adb tcpip 5555
# Connect
adb connect {device ip}:5555
# Disconnect USB
@osamaqarem
osamaqarem / live_templates.md
Last active August 20, 2023 15:25
Android Java Boilerplate

inffrag

    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.$LAYOUT$, container, false);
    ButterKnife.bind(this, view);

    return view;

spinneradapt

@osamaqarem
osamaqarem / nginx_macos.md
Last active May 30, 2024 18:52
Nginx on MacOS

Install nginx (Homebrew)

brew install nginx

Configuration file for nginx will be at /usr/local/etc/nginx/nginx.conf

Web apps can be stored at /usr/local/var/www

Commands

Start:

@osamaqarem
osamaqarem / build.sh
Created January 7, 2021 03:24
Building XCFramework
#!/bin/bash
user=$(id -un)
rm -rf ProjectName.xcframework && \
xcodebuild archive \
-workspace ProjectName.xcworkspace \
-scheme ProjectName \
-destination "generic/platform=iOS" \
-archivePath "archives/ios" \
SKIP_INSTALL=NO \
SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO \
@osamaqarem
osamaqarem / BestAspectRatio.java
Created January 7, 2021 05:40
Calculate Closest Aspect Ratio
private Camera.Size calBestPreviewSize(Camera.Parameters camPara,
final int width, final int height) {
List<Camera.Size> allSupportedSize = camPara.getSupportedPreviewSizes();
ArrayList<Camera.Size> widthLargerSize = new ArrayList<Camera.Size>();
for (Camera.Size tmpSize : allSupportedSize) {
if (tmpSize.width > tmpSize.height) {
widthLargerSize.add(tmpSize);
}
}
@osamaqarem
osamaqarem / CalculateTextureMatrix.Java
Created January 8, 2021 07:06
Android Reverse Camera Matrix
public Matrix calculateTextureMatrix(TextureView textureView, View previewView) {
Matrix matrix = new Matrix();
Camera.Size previewSize = mICamera.mCamera.getParameters().getPreviewSize();
float actualPreviewWidth = previewSize.width;
float actualPreviewHeight = previewSize.height;
float previewWidth = previewView.getWidth();
float previewHeight = previewView.getHeight();
int deviceAndCameraAngleDiff = mICamera.getCameraAngle(this);
import * as React from 'react'
import { Image, StatusBar, StyleSheet, useWindowDimensions } from 'react-native'
import {
PanGestureHandler,
PinchGestureHandler,
PinchGestureHandlerGestureEvent,
TapGestureHandler,
TapGestureHandlerGestureEvent,
} from 'react-native-gesture-handler'
import Animated, {