Skip to content

Instantly share code, notes, and snippets.

View ifarbod's full-sized avatar
🙃
I'm a jack of all trades

iFarbod ifarbod

🙃
I'm a jack of all trades
View GitHub Profile
@lpcdma
lpcdma / launch.json
Created November 6, 2019 06:46
codelldb android
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "attach",
"name": "android_attach",
"pid": "13841",
"initCommands": [
"platform select remote-android",
@kajott
kajott / vaapi_egl_interop_example.c
Last active June 13, 2024 13:45
example code for minimal-overhead hardware-accelerated video decoding and display on Linux using VA-API/EGL interoperability
#if 0 // self-compiling code: chmod +x this file and run it like a script
BINARY=vaapi_egl_interop_example
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -fsanitize=address -o $BINARY $0 \
`pkg-config libavcodec libavformat libavutil libva gl egl libdrm --cflags --libs` \
-lX11 -lva-x11 -lva-drm || exit 1
test "$1" = "--compile-only" && exit 0
exec env ASAN_OPTIONS=fast_unwind_on_malloc=0 ./$BINARY $*
#endif /*
Minimal example application for hardware video decoding on Linux and display
@badlands
badlands / UIDeviceExtensions.swift
Last active May 24, 2019 12:05
UIDeviceExtension: hasNotch
import Foundation
import UIKit
extension UIDevice {
/// Returns 'true' if the current device has a notch
var hasNotch: Bool {
if #available(iOS 11.0, *) {
// Case 1: Portrait && top safe area inset >= 44
let case1 = !UIDevice.current.orientation.isLandscape && (UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) >= 44
@Ademking
Ademking / readme.md
Last active November 5, 2023 15:48
💚 Android : How to record events and play them using ADB SHELL

1) Know the event name of touchpad :

Run :

adb shell getevent -pl

Search for : "ABS_MT_TRACKING_ID" - example :

@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active July 17, 2024 07:40
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@NeroBurner
NeroBurner / main.cpp
Last active August 13, 2019 13:36
rapidjson::Pointer not working in loop
// external libraries
#include "rapidjson/document.h"
#include "rapidjson/pointer.h"
// standard libraries
#include <iostream>
#include <string>
#include <vector>
void parse_json_int(rapidjson::Document &json, const std::string &pointer, int &target)
@CookiePLMonster
CookiePLMonster / sincos.cpp
Last active January 7, 2018 01:21
SSE2 sincos VS15.5.2 issue
#include <iostream>
#include <cmath>
// Compile in Release, x86
// /arch:IA32, /fp:fast
// Resulting code contains SSE opcodes and calls ___libm_sse2_sincosf_
int main()
{
float val = 0.0f;
std::cin >> val;

State of Roblox graphics API across all platforms, with percentage deltas since EOY 2017. Updated December 17 2018

Windows

API Share
Direct3D 11+ 80% (+3%)
Direct3D 10.1 10% (-1%)
Direct3D 10.0 8% (-1%)
Direct3D 9 2% (-1%)
#!/usr/bin/env bash
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\
function register_clang_version {
local version=$1
local priority=$2
update-alternatives \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \
@msimpson
msimpson / !wasmllvm.md
Last active December 2, 2020 18:29 — forked from yurydelendik/!wasmllvm.md
Using WebAssembly in LLVM on Windows

Using WebAssembly in LLVM on Windows

Forewarning: this can be a bit painful and may not work as expected. I've already had issues with even including stdlib through clang.

Installing Dependencies

GIT

Make sure you have git installed and properly configured before continuing. This is trivial on Windows these days (https://git-scm.com/download/win) but is required to pull down Binaryen and Wabt.

Make sure to add the binary to your PATH variable in Windows.