Skip to content

Instantly share code, notes, and snippets.

View bollu's full-sized avatar

Siddharth bollu

View GitHub Profile
#[link(name="python2.7")]
extern {
fn Py_SetProgramName(name: *u8);
fn Py_Initialize();
fn PyRun_SimpleString(command: *u8);
fn Py_Finalize();
}
fn main() {
let args = std::os::args();
@bollu
bollu / run,sh
Created June 14, 2014 09:52
Running rust-bindgen on Arch with clang3.4 has.. problems. This fixes them
LD_PRELOAD=/usr/lib/libclang.so ./bindgen -I /usr/lib/clang/3.4.1/include/
#the LD_PRELOAD helps it pickup the right clang version
#the -I gives it clang's include files
@bollu
bollu / pie-with-legend.js
Created July 13, 2014 09:31
Abstraction over HighCharts
function draw_pie_chart(container_selector, name, title, data) {
// Build the chart
$(container_selector).highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
@bollu
bollu / density-of-rationals
Last active August 29, 2015 14:11
Density Of rationals
* Density of Real Numbers in R
∀a,b ∈ R, such that a < b, ∃t ∈ R such that a < t < b
** Proof
∀a, b, ∈ R, such that a < b
let t = (a + b)/2 ∈ R since a, b ∈ R
let δ = (b - a)/2 ∈ R
@bollu
bollu / vispy-code-complexity.txt
Last active August 29, 2015 14:26
measure vispy's code complexity using radon
~/p/vispy   colorbar-vispy-plot *$  radon cc vispy -nc -a Sun Aug 2 00:36:08 IST 2015
vispy/scene/canvas.py
M 321:4 SceneCanvas._process_mouse_event - C
M 392:4 SceneCanvas._visual_bounds_at - C
vispy/scene/visuals.py
F 133:0 generate_docstring - C
vispy/scene/cameras/base_camera.py
M 227:4 BaseCamera.set_range - C
vispy/scene/cameras/panzoom.py
M 191:4 PanZoomCamera.viewbox_mouse_event - C
@bollu
bollu / sandhi-installer.sh
Last active September 21, 2015 17:01
Install script for sandhi
#!/usr/bin/env bash
# automatically abort if any command fails
set -e
echo "This script assumes superuser privileges. You might have to run this script with sudo"
echo "Installing dependencies required by sandhi..."
apt-get update
apt-get -y install git git-core autoconf automake make libtool g++ python-dev swig \
@bollu
bollu / vimrc
Created October 20, 2015 16:06
call plug#begin('~/.vim/plugged')
"Core
Plug 'terryma/vim-expand-region'
Plug 'Valloric/YouCompleteMe'
Plug 'kien/ctrlp.vim'
Plug 'majutsushi/tagbar'
Plug 'ervandew/supertab'
@bollu
bollu / gist:7373614
Created November 8, 2013 16:25
error log archlinux 64 bit build
Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING:../native/Android.mk:native: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:jni/Android.mk:ppsspp_jni: non-system libraries in linker flags: jni/../../ffmpeg/android/armv7/lib/libavformat.a jni/../../ffmpeg/android/armv7/lib/libavcodec.a jni/../../ffmpeg/android/armv7/lib/libswresample.a jni/../../ffmpeg/android/armv7/lib/libswscale.a jni/../../ffmpeg/android/armv7/lib/libavutil.a
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:../native/ext/libzip/Android.mk:zip: LOCAL_LDLIBS is always ignored for static libraries
jni/Android.mk:304: warning: overriding commands for target `jni/../../git-version.cpp'
jni/Android.mk:304: warning: ignoring o
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where
data Free f a = Pure a | Branch (f (Free f a))
deriving instance (Show a, Show (f (Free f a))) => Show (Free f a)
@bollu
bollu / forall.hs
Last active January 8, 2016 20:21
{-# LANGUAGE RankNTypes #-}
f :: ((forall b. a -> (b -> r) -> r) -> (a -> r) -> r) -> (a -> r) -> r
f g h = let x = (\a b' -> h a) :: (forall b. a -> (b -> r) -> r) in g x h