Skip to content

Instantly share code, notes, and snippets.

@vittorioromeo
vittorioromeo / recGif.sh
Last active December 22, 2015 05:29
byzanz-record window gif
#!/bin/sh
INFO=$(xwininfo -frame)
WIN_GEO="--width="
WIN_GEO="$WIN_GEO$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')"
WIN_XY="--x="
WIN_XY="$WIN_XY$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/+/ --y=/' )"
WIN_HEI=`echo $WIN_GEO | sed s/x/\\ --height=/g`
filename="$1.gif"
@vittorioromeo
vittorioromeo / fastfuncarraydelegate.cpp
Created September 5, 2013 10:59
fastfunc arraydelegate
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <type_traits>
#include <utility>
@vittorioromeo
vittorioromeo / fastdelegatetests2.cpp
Last active March 24, 2019 10:33
fastdelegate tests
#ifndef FASTDELEGATE_H
#define FASTDELEGATE_H
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
@vittorioromeo
vittorioromeo / gist:6461633
Created September 6, 2013 09:37
fastdelegatestatic
#ifndef LIGHTPTR_HPP
#define LIGHTPTR_HPP
#include <atomic>
#include <cassert>
#include <bitset>
#include <memory>
#include <new>
#include <type_traits>
#include <utility>
@vittorioromeo
vittorioromeo / FastFunc.hpp
Last active August 24, 2023 08:15
Don Clugston's fast delegate C++11 implementation
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
SSVU_TEST("Delegate tests")
{
using namespace std;
using namespace ssvu;
bool testState{false};
Delegate<void()> del1;
del1 += [&testState]{ testState = !testState; };
del1(); EXPECT(testState == true);
template<typename T> class PingPongValue
{
private:
T value, min, max, speed, dir{1};
public:
inline PingPongValue(T mMin, T mMax, T mSpeed) : value(mMin), min(mMin), max(mMax), speed(mSpeed) { }
inline void update(float mFT)
{
value += speed * mFT * dir;
@vittorioromeo
vittorioromeo / gist:6867570
Last active December 24, 2015 21:39
Yaourt packages
a52dec
aalib
acl
alsa-lib
alsa-plugins
alsa-utils
apng-utils
apr
apr-util
archlinux-keyring