Skip to content

Instantly share code, notes, and snippets.

@ChrisLundquist
ChrisLundquist / default_interface
Created Oct 16, 2012
ohai broken ipaddress attribute with missing eth0
View default_interface
ohai network/default_interface
[
"venet0"
]
@ChrisLundquist
ChrisLundquist / collectd.conf.example
Created Oct 16, 2012
collectd filter read plugins to certain write plugins
View collectd.conf.example
<Rule "to_aggregation">
<Match regex>
Plugin "myplugin"
</Match>
<Target write>
Plugin aggregation
</Target>
</Rule>
View routes.rb
AistroidsCom::Application.routes.draw do
root :to => "home#index"
devise_for :users
resources :bots
resources :users do
resources :bots
end
end
@ChrisLundquist
ChrisLundquist / gist:3879043
Created Oct 12, 2012
DCI with refine, short syntax
View gist:3879043
2.0.0dev :001 > class Foo; end
=> nil
2.0.0dev :002 > class Bar; end
=> nil
2.0.0dev :003 > class Baz; end
=> nil
2.0.0dev :010 > module Runner
2.0.0dev :011?> [Foo,Bar,Baz].each do |klass|
2.0.0dev :012 > refine klass do
2.0.0dev :013 > def run
View gist:3862736
public class Dice {
public:
Dice();
void roll();
int get_value();
string to_string();
IMAGE get_image();
private:
int value;
@ChrisLundquist
ChrisLundquist / page_test.cpp
Created Sep 14, 2012
Proof of concept for Page allocator
View page_test.cpp
#include <iostream>
template <int size> class Page{
char bytes[size];
};
int main(void) {
Page<10> p1;
Page<200> p2;
@ChrisLundquist
ChrisLundquist / proof.txt
Created Sep 13, 2012
Success of cl.exe via ssh to a win 7 guest
View proof.txt
localhost:nebula clundquist$ ssh win
Last login: Thu Sep 13 14:15:09 2012 from 10.0.2.2
Durandal@Simulacrum ~
$ cl.exe
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
@ChrisLundquist
ChrisLundquist / .msvc.sh
Created Sep 13, 2012
msvc env for cygwin
View .msvc.sh
INCLUDE='c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\INCLUDE;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include;'
INFOPATH='/usr/local/info:/usr/share/info:/usr/info:/usr/local/info:/usr/share/info:/usr/info:'
LIB='c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib;'
LIBPATH='c:\Windows\Microsoft.NET\Framework\v4.0.30319;c:\Windows\Microsoft.NET\Framework\v3.5;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;'
WindowsSdkDir='c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\'
VSINSTALLDIR='c:\Program Files (x86)\Microsoft Visual Studio 10.0\'
VCINSTALLDIR='c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\'
MSVC_PATH='/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VSTSDB/Dep
@ChrisLundquist
ChrisLundquist / gist:3435159
Created Aug 23, 2012
valgrind output on Mountain Lion
View gist:3435159
=46255==
==46255== HEAP SUMMARY:
==46255== in use at exit: 63,867 bytes in 354 blocks
==46255== total heap usage: 1,459 allocs, 1,105 frees, 162,223 bytes allocated
==46255==
==46255== 16 bytes in 1 blocks are definitely lost in loss record 7 of 84
==46255== at 0xC8E6: malloc_zone_malloc (vg_replace_malloc.c:276)
==46255== by 0x4F1413: recursive_mutex_init (in /usr/lib/libobjc.A.dylib)
==46255== by 0x4F0025: _objc_init (in /usr/lib/libobjc.A.dylib)
==46255== by 0x134B27: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
View gist:3093930
root@collectd03:/opt/razor# git remote update
Fetching origin
Fetching bluebox
Fetching lynxbat
root@collectd03:/opt/razor# git diff lynxbat/master
diff --git a/bin/razor b/bin/razor
index 910ac06..8d0f080 100755