Skip to content

Instantly share code, notes, and snippets.

@henrikno
henrikno / gist:1310028
Created October 24, 2011 20:16
SDL example
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
void Render() {
glClearColor( 0, 0, 0, 0 );
}
int main(int argc, char *argv[])
{
int rc = SDL_Init(SDL_INIT_VIDEO);
@henrikno
henrikno / sfml.cpp
Created October 24, 2011 20:49
SFML example
/* Compile with:_
g++ sfml.cpp -lsfml-system -lsfml-graphics -lsfml-window -o sfml
*/
#include <SFML/Graphics.hpp>
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace sf;
@henrikno
henrikno / record-desktop.sh
Created May 1, 2012 18:09
ffmpeg record scripts
#!/bin/bash -x
INRES="1920x1200"
OUTRES="1280x720"
FPS="30"
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -ac 2 \
-i default -vcodec libx264 -s "$OUTRES" \
-acodec libmp3lame -ab 128k -ar 44100 \
-threads 0 -f flv $1
@henrikno
henrikno / PortAudio.cpp
Created May 24, 2013 18:46
Sound + FT-example
#include "PortAudio.h"
#include <portaudio.h>
#include <cstdio>
float spec_left[512];
float spec_right[512];
PortAudio::PortAudio() {
PaError err;
err = Pa_Initialize();
#include "Font.h"
#include <GL/glew.h>
#include <cstdio>
#include <cassert>
#include <cstdlib>
void Font::SetHeight(float h) {
m_height = h;
}
@henrikno
henrikno / logging
Last active December 24, 2015 05:49
ITRestEasyExample log
Running com.github.kristofa.brave.resteasyexample.ITRestEasyExample
16:20:16,183 INFO [main] server.Server (Server.java:270) - jetty-8.1.9.v20130131
16:20:16,352 INFO [main] webapp.StandardDescriptorProcessor (StandardDescriptorProcessor.java:282) - NO JSP Support for /RestEasyTest, did not find org.apache.jasper.servlet.JspServlet
16:20:16,534 INFO [main] handler.ContextHandler$Context (ContextHandler.java:2021) - Initializing Spring FrameworkServlet 'dispatcher'
16:20:16,534 INFO [main] servlet.FrameworkServlet (FrameworkServlet.java:454) - FrameworkServlet 'dispatcher': initialization started
16:20:16,552 INFO [main] support.AbstractApplicationContext (AbstractApplicationContext.java:510) - Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Sun Sep 29 16:20:16 CEST 2013]; root of context hierarchy
16:20:16,678 INFO [main] support.AnnotationConfigWebApplicationContext (AnnotationConfigWebApplicationContext.java:245) - Found 11 annotated classes in package [com.github.kr
@henrikno
henrikno / gist:6966707
Created October 13, 2013 19:52
Building brave-zipkin-spancollector in maven 3.0.5
[INFO] ------------------------------------------------------------------------
[INFO] Building brave-zipkin-spancollector 2.0.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ brave-zipkin-spancollector ---
[INFO] Deleting /home/henrik/Dropbox/code/brave/brave-zipkin-spancollector/target
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ brave-zipkin-spancollector ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ brave-zipkin-spancollector ---
@henrikno
henrikno / MyListener.java
Created November 5, 2013 09:25
LeaderSelector
@Override
public void takeLeadership(CuratorFramework curatorFramework) throws Exception {
ourThread = Thread.currentThread();
logger.debug(format("(%s) Got leadership", ourThread));
try {
waitForAndPerformWork();
} catch (InterruptedException e) {
logger.debug(format("(%s) Interrupted ", ourThread), e);
} finally {
logger.debug(format("(%s) No longer leader", ourThread));
@henrikno
henrikno / ElasticSearchTest.java
Created September 2, 2015 13:52
Elasticsearch bulk index with retry and failure check
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.elasticsearch.action.WriteConsistencyLevel;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
### Keybase proof
I hereby claim:
* I am henrikno on github.
* I am henrikno (https://keybase.io/henrikno) on keybase.
* I have a public key ASDW-yzrF0xb95QlVFxbM29dhaYqKlvyFAxIienhFwbzFQo
To claim this, I am signing this object: