Skip to content

Instantly share code, notes, and snippets.

Avatar
😸
Pondering language design...

serialhex

😸
Pondering language design...
View GitHub Profile
@serialhex
serialhex / .bash_chroot
Created Apr 3, 2011
trying to chroot into a gentoo system on my computer...
View .bash_chroot
source /root/.bashrc
echo "doing cool gentoo-ish things..."
/usr/sbin/env-update
source /etc/profile
@serialhex
serialhex / Mathematics.h
Created Apr 10, 2011
returns a normally distributed random number...
View Mathematics.h
// 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 Apr 19, 2011
learn the measure of a thing if it can only be measured in prime numbers...
View measure.rb
#!/usr/bin/env ruby
require 'prime'
def nth_prime(n)
pr = Prime.new
t = 0
n.times do
t = pr.next
end
View AttributeFeatures.cpp
/*
* 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
test of shogun ruby configure stuffs
View configure
# 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}"
View classifier_libsvm_minimal_modular.rb
#!/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'
View build.xml
<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"/>
View gist:1034570
--------------------------------------------------------------------------------
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 Jun 25, 2011
wonky python_modular error...
View gist:1046813
[~/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 Jun 26, 2011
awsum downloader of awsumness
View download-o-matic.rb
#!/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|