Skip to content

Instantly share code, notes, and snippets.

@deepanshululla
deepanshululla / thread_safe_queue.cpp
Last active April 27, 2022 09:42
thread_safe_queue.cpp
#include <exception>
#include <memory>
#include <mutex>
#include <queue>
struct EmptyQueueException : std::exception {
const char * what() const throw() {
return "Empty queue";
}
};
@danijar
danijar / blog_tensorflow_variable_sequence_labelling.py
Last active May 15, 2022 14:28
TensorFlow Variable-Length Sequence Labelling
# Working example for my blog post at:
# http://danijar.com/variable-sequence-lengths-in-tensorflow/
import functools
import sets
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import rnn
def lazy_property(function):
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
class RNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size, n_layers=1):
super(RNN, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@roxlu
roxlu / X264Encoder.cpp
Created June 26, 2013 21:01
X264 encoder example
#include <roxlu/core/Log.h>
#include <roxlu/core/Utils.h>
#include <video/X264Encoder.h>
X264Encoder::X264Encoder()
:in_width(0)
,in_height(0)
,in_pixel_format(AV_PIX_FMT_NONE)
,out_width(0)
,out_height(0)
@stormraiser
stormraiser / danbooru_faces.md
Last active January 21, 2023 16:57
Danbooru Faces dataset

Danbooru Faces v0.1

Discription

This dataset contains ~443k anime face images of size 256x256 drawn by ~7,000 artists, obtained from Danbooru

Collection

We first downloaded JSON files of all existing posts numbered from 1 to 2,800,000 using their API. We filtered the posts by the following criteria:

@Brainiarc7
Brainiarc7 / ffmppeg-advanced-playbook-nvenc-and-libav-and-vaapi.md
Last active May 5, 2023 01:51
FFMpeg's playbook: Advanced encoding options with hardware-accelerated acceleration for both NVIDIA NVENC's and Intel's VAAPI-based hardware encoders in both ffmpeg and libav.

FFmpeg and libav's playbook: Advanced encoding options with hardware-based acceleration, NVIDIA's NVENC and Intel's VAAPI-based encoder.

Hello guys,

Continuing from this guide to building ffmpeg and libav with NVENC and VAAPI enabled, this snippet will cover advanced options that you can use with ffmpeg and libav on both NVENC and VAAPI hardware-based encoders.

For ffmpeg:

@luca-bernardi
luca-bernardi / AVAsset+VideoOrientation.h
Created February 23, 2013 18:12
Find the video orientation of an AVAsset. (Useful if you need to send the video to a remote server)
//
// AVAsset+VideoOrientation.h
//
// Created by Luca Bernardi on 19/09/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
typedef enum {
LBVideoOrientationUp, //Device starts recording in Portrait
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@clementgenzmer
clementgenzmer / FBAnimationPerformanceTracker.h
Last active September 18, 2023 23:02
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN