Skip to content

Instantly share code, notes, and snippets.

View kaixiong's full-sized avatar

Chong Kai Xiong kaixiong

View GitHub Profile
@kaixiong
kaixiong / gist:2170935
Created March 23, 2012 14:03
FroyVisuals <-> LV diff
diff -aurb --exclude '*.mk' --exclude '*.a' --exclude examples --exclude .git --exclude CHANGELOG --exclude COPYING --exclude '.hg*' libvisual.master/libvisual/libvisual/libvisual.h FroyVisuals/jni/libvisual/libvisual.h
--- libvisual.master/libvisual/libvisual/libvisual.h 2012-03-22 16:52:33.558363930 +0800
+++ FroyVisuals/jni/libvisual/libvisual.h 2012-03-02 22:05:29.427672445 +0800
@@ -24,46 +24,46 @@
#ifndef LV_LIBVISUAL_H
#define LV_LIBVISUAL_H
-#include <libvisual/lvconfig.h>
+#include "lvconfig.h"
static void act_init_parameters (VisPluginData *plugin) {
VisParamContainer *params = visual_plugin_get_params (plugin);
VISUAL_PARAM_ADD_COLOR (params, "color" , 0x00, 0xff, 0xff, VISUAL_CONSTRAINT_NONE, N_("Color"));
VISUAL_PARAM_ADD_STRING (params, "color_style" , "Rainbow" , VISUAL_CONSTRAINT_NONE, N_("Color style"));
VISUAL_PARAM_ADD_STRING (params, "signal_color" , "Normal signal" , VISUAL_CONSTRAINT_NONE, N_("Signal color"));
VISUAL_PARAM_ADD_BOOL (params, "contour_lines" , FALSE , N_("Contour lines"));
VISUAL_PARAM_ADD_BOOL (params, "hue_on_beats" , FALSE , N_("Change hue on beats"));
VISUAL_PARAM_ADD_COLOR (params, "background" , 0x00, 0xff, 0xff, VISUAL_CONSTRAINT_NONE, N_("Background color"));
VISUAL_PARAM_ADD_STRING (params, "blur_style" , "Random" , VISUAL_CONSTRAINT_NONE, N_("Blur style"));
kaixiong@dreamerbox:~/installs/libvisual-0.5/bin$ valgrind ./lv-tool
==6977== Memcheck, a memory error detector
==6977== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==6977== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==6977== Command: ./lv-tool
==6977==
./lv-tool v0.1
DEBUG CPU: Number of CPUs: 2
DEBUG CPU: type 3
DEBUG CPU: X86 type 6
#include "config.h"
#include "lv_ringbuffer.h"
#include "lv_common.h"
#include "gettext.h"
#include <vector>
namespace LV {
namespace {
#include <libvisual/libvisual.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#include <boost/format.hpp>
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
typedef std::vector<LV::Time> TimingProfile;
kaixiong@dreamerbox:~/Documents/projects/libvisual$ git pull
remote: Counting objects: 100, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 40 (delta 27), reused 40 (delta 27)
Unpacking objects: 100% (40/40), done.
From github.com:Libvisual/libvisual
dd5ac7a..ae678da cxx -> origin/cxx
Updating dd5ac7a..ae678da
Fast-forward
libvisual-plugins/plugins/input/jack/input_jack.cpp | 33 ++++++++++++++-------------------
kaixiong@dreamerbox:~/Documents/projects/libvisual/libvisual/build$ lv-tool -i pulseaudio -f 0
lv-tool v0.1
Loading actor 'lv_analyzer'...
Loading input 'pulseaudio'...
0.15332912
0.00005442
0.00007324
0.00004757
0.15461316
0.00004697
@kaixiong
kaixiong / gist:4708432
Created February 4, 2013 18:12
lv-tool valgrind full memory leak check
==9979== Memcheck, a memory error detector
==9979== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==9979== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==9979== Command: /home/kaixiong/installs/libvisual-0.5/bin/lv-tool
==9979==
/home/kaixiong/installs/libvisual-0.5/bin/lv-tool - libvisual-0.5.0 (257c138-dirty) commandline tool - http://libvisual.org
==9979==
==9979== HEAP SUMMARY:
==9979== in use at exit: 108,336 bytes in 538 blocks
==9979== total heap usage: 3,933 allocs, 3,395 frees, 1,837,113 bytes allocated
@kaixiong
kaixiong / random
Last active December 20, 2015 02:38
Benchmarks of various ways to generate random numbers in a given range
#include <cstdint>
#include <ctime>
#include <random>
#include <boost/format.hpp>
#define RUN_COUNT 100000
#define RANGE_MIN 100
#define RANGE_MAX 100000
typedef std::minstd_rand PRNG;
<?php
// Usage: icon_letters.php?FN=symbol&L=m&L_B=250&L_R=00&L_G=150&BG_B=100&BG_R=150&BG_G=250
// Usage: icon_letters.php?FN=kaiu&dx=-3&dy=0&BG_B=100&BG_R=100&L=陈
$width_height = 320;
//Send a generated image to the browser
$LETTERS_MAX_LEN = 3;
$letters = "SDP";
if (isset($_GET['L'])) {