Skip to content

Instantly share code, notes, and snippets.

View serialhex's full-sized avatar
😸
Pondering language design...

serialhex

😸
Pondering language design...
View GitHub Profile
@serialhex
serialhex / .bash_chroot
Created April 3, 2011 03:22
trying to chroot into a gentoo system on my computer...
source /root/.bashrc
echo "doing cool gentoo-ish things..."
/usr/sbin/env-update
source /etc/profile
@serialhex
serialhex / Mathematics.h
Created April 10, 2011 21:39
returns a normally distributed random number...
// lots of code...
/// Returns a Gaussian or Normal random number.
/// By default the mean = 0 and variance = 1
/// Using the polar form of the Box-Muller transform.
/// http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform#Polar_form
static inline float32_t normal_random(float32_t mean=0.0, float32_t variance=1.0)
{
// sets up variables
float32_t rand_u = random(-1.0, 1.0);
@serialhex
serialhex / measure.rb
Created April 19, 2011 04:58
learn the measure of a thing if it can only be measured in prime numbers...
#!/usr/bin/env ruby
require 'prime'
def nth_prime(n)
pr = Prime.new
t = 0
n.times do
t = pr.next
end
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2009 Soeren Sonnenburg
* Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
@serialhex
serialhex / configure
Created May 22, 2011 21:11
test of shogun ruby configure stuffs
# around line 580
test_ruby()
{
echocheck "Ruby"
if ruby -v >/dev/null 2>&1
then
RUBYVER=`ruby -v 2>&1 | head -n 1 | cut -f 2 -d ' '`
echores "${RUBYVER}"
@serialhex
serialhex / classifier_libsvm_minimal_modular.rb
Created June 8, 2011 22:03
shogun libSVM minimal example
#!/usr/bin/env ruby
## copy from ../examples/undocumented/python_modular/classifier_libsvm_minimal_modular.py
require '../../../src/ruby_modular/Features'
require '../../../src/ruby_modular/Classifier'
require '../../../src/ruby_modular/Kernel'
# for randn func
require '../../../src/ruby_modular/Library'
<project name="shogun" default="dist" basedir=".">
<description>
shogun java modular
</description>
<!-- set global properties for this build -->
<property name="src" location="."/>
<property name="classes" location="classes"/>
<property name="test" location="../../examples/undocumented/java_modular/"/>
<path id="project.classpath">
<pathelement location="shogun.jar"/>
@serialhex
serialhex / gist:1034570
Created June 19, 2011 18:34
shogun loc
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
C++ 267 15157 7678 74644
C/C++ Header 306 8755 25594 29778
Python 298 4074 1926 13728
MATLAB 274 2066 1025 8750
Bourne Again Shell 1 385 196 4049
Java 43 315 0 1097
XML 9 87 19 1080
@serialhex
serialhex / gist:1046813
Created June 25, 2011 19:38
wonky python_modular error...
[~/src/shogun/shogun/examples/undocumented/python_modular]$ python2 classifier_libsvm_minimal_modular.py *[feature/ruby-mod][ruby-1.9.2-p180]
Traceback (most recent call last):
File "classifier_libsvm_minimal_modular.py", line 3, in <module>
from shogun.Features import *
File "/usr/lib/python2.7/site-packages/shogun/Features.py", line 30, in <module>
_Features = swig_import_helper()
File "/usr/lib/python2.7/site-packages/shogun/Features.py", line 26, in swig_import_helper
_mod = imp.load_module('_Features', fp, pathname, description)
ImportError: /usr/lib/python2.7/site-packages/shogun/_Features.so: undefined symbol: _ZN6shogun9CFeatures16add_preprocessorEPNS_13CPreprocessorE
@serialhex
serialhex / download-o-matic.rb
Created June 26, 2011 06:04
awsum downloader of awsumness
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'pry'
# gets webpages of links and such
puts "getting the main pages..."
docs = [] # i hate doing that
(1..6).each do |n|