Skip to content

Instantly share code, notes, and snippets.

@maxammann
maxammann / gist:a4665ff3138c87851ee23a1e9153bcff
Last active May 12, 2018 09:32
Unified Remote Server Systemd service
[Unit]
Description=Unified Remote Server
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash /opt/urserver/urserver-start --no-manager --no-copy
ExecStop=/bin/bash /opt/urserver/urserver-stop
Environment=DISPLAY=:0
@maxammann
maxammann / gist:b98366bffe625d88bdd10da307b1c270
Created August 7, 2017 06:20
OpenCL 1.2 AMD-APP not supported
clinfo: /opt/cuda/lib64/libOpenCL.so.1: no version information available (required by clinfo)
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (2442.7)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Extensions function suffix AMD
Platform Name AMD Accelerated Parallel Processing
@maxammann
maxammann / gist:7608245fc7c8c96e2016
Created December 16, 2015 15:12
GoldenCheetah Arch Build
cd qwt/ && make -f Makefile
make[1]: Verzeichnis „/root/GoldenCheetah/qwt“ wird betreten
cd src/ && make -f Makefile
make[2]: Verzeichnis „/root/GoldenCheetah/qwt/src“ wird betreten
g++ -c -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fPIC -Wall -W -D_REENTRANT -DQWT_NO_SVG -DQWT_NO_OPENGL -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Imoc -o obj/qwt_abstract_scale_draw.o qwt_abstract_scale_draw.cpp
g++ -c -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fPIC -Wall -W -D_REENTRANT -DQWT_NO_SVG -DQWT_NO_OPENGL -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Imoc -o obj/qwt_clipper.o qwt_clipper.cpp
g++ -c -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fPIC -Wall -W -D_REENTRANT
@maxammann
maxammann / main.c
Last active May 21, 2018 01:51
Example how to visualize libav output in a spectrum
int open_file(char *file_path, AVFormatContext **fmt_ctx, AVCodecContext **dec_ctx) {
int audio_stream_index;
AVCodec *codec;
// Find codec and stream
if (avformat_open_input(fmt_ctx, file_path, NULL, NULL) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
return -1;
}
@maxammann
maxammann / audio.c
Created March 22, 2015 15:48
libao and libsndfile: PCM playback (.wav, .aiff, .ogg)
#include <ao/ao.h>
#include <sndfile.h>
#include <signal.h>
#define BUFFER_SIZE 8192
int cancel_playback;
void on_cancel_playback(int sig) {
if (sig != SIGINT) {
@maxammann
maxammann / gist:4fdb8f7473039eff00bb
Created September 20, 2014 10:28
Check .doc documents
find . -type f -name "*.doc" -exec sh -c "catdoc {} | head -1" \;
@maxammann
maxammann / gist:5791845
Created June 16, 2013 12:05
LevelCache
public class ExponentialLevelCache extends LevelCache {
private final double modifier;
public ExponentialLevelCache(int maxLevel, int minLevel, double modifier) {
super(maxLevel, minLevel);
this.modifier = modifier;
}
@maxammann
maxammann / gist:5791580
Created June 16, 2013 09:59
LinkedTree
import org.apache.commons.collections.iterators.ArrayIterator;
import java.util.Arrays;
import java.util.Iterator;
/**
* Represents a LinkedNode
*/
public class LinkedNode<T> implements Iterable<LinkedNode<T>> {
@DatabaseTable(name = "table")
public class Person implements TableObject {
@DatabaseColumn(position = 1, databaseName = "id", id = true)
private int id;
private String name;
@DatabaseColumn(position = 3, databaseName = "age")
private int age;