Skip to content

Instantly share code, notes, and snippets.

@jonforums
jonforums / build_zlib.ps1
Last active December 14, 2015 13:48
Automate building zlib on Windows with mingw/mingw-w64
#requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-11 01:39:59 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add proper try-catch-finally error handling
# - support x86 and x64 builds
@jonforums
jonforums / build_libffi.ps1
Last active December 14, 2015 12:38
Automate building libffi on Windows with mingw/mingw-w64
#requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-11 00:37:25 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add proper try-catch-finally error handling
# - support x86 and x64 builds
@jonforums
jonforums / build_tcltk.ps1
Last active December 14, 2015 11:38
Automate building TclTk on Windows with mingw/mingw-w64
#requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-04 18:48:14 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add try-catch-finally error handling
# - add checkpoint support
@jonforums
jonforums / scriptblock_tricks.ps1
Last active December 13, 2015 18:38
toying with powershell scriptblocks
#require -version 2.0
function invoker($data, $fcn) { $fcn.Invoke($data) }
$sport = 'ski'
$lambda = { param ($who) write-host "Hello $who, do you $sport" }
# direct call with mixed array of mixed values
& $lambda 'Foo', 7
@jonforums
jonforums / build_openssl.ps1
Last active July 7, 2016 12:23
Automate building OpenSSL on Windows with mingw/mingw-w64
#requires -version 2.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2013-03-11 01:24:20 -0600
#
# TODO:
# - extract generics into a downloadable utils helper module
# - add try-catch-finally error handling
# - add checkpoint support
@jonforums
jonforums / yahoo_pull.r
Created January 9, 2013 17:36
Simple R script to pull historical stock data from Yahoo
# Revision: 2013-01-09 12:34:09 -0600
getYahooStockUrl <- function(symbol, start, end, type="m") {
# Creates a Yahoo URL for fetching historical stock data
#
# Args:
# symbol - the stock symbol for which to fetch data
# start - the date (CCYY-MM-DD) to start fetching data
# end - the date (CCYY-MM-DD) to finish fetching data
# type - daily/monthly data indicator ("d" or "m")
@jonforums
jonforums / Preferences.sublime-settings
Last active December 10, 2015 21:18
My SublimeText2 user preferences
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"highlight_line": true,
"caret_style": "wide",
"fade_fold_buttons": false,
"default_line_ending": "unix",
"fallback_encoding": "UTF-8",
@jonforums
jonforums / basic_lp.py
Created November 22, 2012 05:46
basic cvxopt linear programming
import numpy as np
from cvxopt import matrix, printing, solvers
# configuration - turn down the volume and set output formatting
solvers.options['show_progress'] = False
solvers.options['LPX_K_MSGLEV'] = 0
printing.options['dformat'] = '% .3f'
# MINIMIZE - portfolio of current bond prices
@jonforums
jonforums / 174_mod.patch
Created November 4, 2012 01:34
Yura's array as queue patch
From 6ba6eebc2e7dd309c9113ebfbb8c8e0e90542d21 Mon Sep 17 00:00:00 2001
From: Sokolov Yura 'funny-falcon <funny.falcon@gmail.com>
Date: Sun, 2 Sep 2012 13:46:17 +0400
Subject: [PATCH 1/4] array.c: steal shared array's container when
ARY_SHARED_NUM == 1
- Do not allocate new memory in rb_ary_modify when ARY_SHARED_NUM == 1
and length almost same.
- Store ARY_CAPA instead of RARRAY_LEN in ary_make_shared, to make it useful
- Fix rb_ary_sort_bang accordantly
diff --git a/ext/oj/extconf.rb b/ext/oj/extconf.rb
index dd082ef..806076a 100644
--- a/ext/oj/extconf.rb
+++ b/ext/oj/extconf.rb
@@ -1,11 +1,14 @@
require 'mkmf'
+require 'rbconfig'
extension_name = 'oj'
dir_config(extension_name)