Skip to content

Instantly share code, notes, and snippets.

@vade
vade / synopsis-video-decode-benchmark.m
Last active July 3, 2024 07:34
synopsis-video-decode-benchmark - AVFoundation Performance on Apple Silicon
//
// main.m
// synopsis-video-decode-benchmark
//
// Created by Anton Marini on 11/20/21.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <Metal/Metal.h>
@llbbl
llbbl / fix_openssl_catalina.sh
Last active November 3, 2023 06:05
fix missing openssl files in catalina
#!/bin/bash
echo 'update brew'
brew update
echo 'upgrade brew'
brew upgrade
@sergey-shambir
sergey-shambir / install-clang.sh
Last active November 20, 2023 10:16
install clang on Debian 9
# Add apt.llvm.org repository and install clang
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch main"
sudo apt-get update
sudo apt-get install -y clang clang-format clang-tidy lldb libc++-8-dev libc++abi-8-dev
# Check version
clang --version
clang++ --version
@gauss256
gauss256 / cola_test.py
Created May 5, 2018 23:42
Script to confirm that STFT can be invertible without the COLA constraint being satisfied
"""Framework to confirm that STFT is invertible even if window is not COLA
For the theory behind this, see: https://gauss256.github.io/blog/cola.html"""
import numpy as np
from scipy import signal
def stft(x, w, nperseg, nhop):
"""Forward STFT"""
X = np.array(
@mbinna
mbinna / effective_modern_cmake.md
Last active July 6, 2024 03:59
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@roopalgarg
roopalgarg / tensorflow-add-noise.py
Created March 11, 2017 08:04
tensorflow: add noise
import tensorflow as tf
import numpy as np
def gaussian_noise_layer(input_layer, std):
noise = tf.random_normal(shape=tf.shape(input_layer), mean=0.0, stddev=std, dtype=tf.float32)
return input_layer + noise
inp = tf.placeholder(tf.float32, shape=[None, 8], name='input')
@MarkVillacampa
MarkVillacampa / extract_static_lib.sh
Last active April 11, 2023 07:44
Simple script to extract all the object files (.o) from a static library. By default it extracts the x86_64 architecture but can be easily changed. This is useful to inspect static libraries with Hopper (http://www.hopperapp.com) (You can inspect static libraries with Hopper but it will make you choose with .o file you want to inspect each time).
#!/usr/bin/env bash
lipo -extract_family x86_64 $1 -o $1_thin
mkdir $1_objs
cd $1_objs
ar -x ../$1_thin
@nstarke
nstarke / release-android-debuggable.md
Last active June 26, 2024 15:20
How to make a Release Android App debuggable

How to make a Release Android App debuggable

Let's say you want to access the application shared preferences in /data/data/com.mypackage.
You could try to run adb shell and then run-as com.mypackage ( or adb shell run-as com.mypackge ls /data/data/com.mypackage/shared_prefs), but on a production release app downloaded from an app store you're most likely to see:

run-as: Package 'com.mypackage' is not debuggable
@subfuzion
subfuzion / curl.md
Last active July 3, 2024 11:43
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@waveacme
waveacme / DecodeActivity.java
Created January 15, 2016 08:30
MediaCodec decode h264 example
//from https://github.com/vecio/MediaCodecDemo
package io.vec.demo.mediacodec;
import java.nio.ByteBuffer;
import android.app.Activity;
import android.media.MediaCodec;
import android.media.MediaCodec.BufferInfo;