Skip to content

Instantly share code, notes, and snippets.

View larryv's full-sized avatar

Lawrence Velázquez larryv

View GitHub Profile
[08:18:44] <irker657> larryv at macports dot org * https://trac.macports.org/changeset/102473 /trunk/dports/devel/pcre/ (files/configure.diff files Portfile):
[08:18:44] <irker657> pcre: Avoid unnecessary -pthread flag (#37916).
[08:21:37] *** yue has quit IRC
[08:27:53] <egallager_> larryv: could that patchfile be conditionally applied, only if configure.compiler == clang? iirc the original issue said it was only a clang issue...
[08:31:38] <larryv> as far as i can tell, -pthread is unnecessary across the board
[08:31:49] <larryv> libSystem provides it
[08:32:26] <larryv> to be sure, i tested with apple-gcc42 and gcc47, and neither complained
[08:32:36] *** JaRoel|4d has quit IRC
[08:32:41] <egallager_> ok, fair enough
[08:33:47] <larryv> and even if they did need it, the configure script would figure that out eventually. just after a couple more failed attempts than before
function s:CalculateChecksum(file, hash)
let [f, h] = [shellescape(a:file), shellescape(a:hash)]
let cmd = printf('openssl dgst -%s %s', h, f)
return matchstr(system(cmd), '\X\zs\x\+\ze\n$')
endfunction
function s:ChecksumDistfile(name, path, urls, hashes)
let tmp = tempname()
if filereadable(a:path)
call system(printf('ln -s %s %s', shellescape(a:path), tmp))
else
@larryv
larryv / diet.data
Created September 11, 2013 20:54
The diet problem in GNU MathProg.
set Foods := Rice Quinoa Tortilla Lentils Broccoli;
set NutrientTypes := Carbs Proteins Fat;
param Nutrients:
Carbs Proteins Fat :=
Rice 53 4.4 0.4
Quinoa 40 8 3.6
Tortilla 12 3 2
Lentils 53 12 0.9
Broccoli 6 1.9 0.3
@larryv
larryv / ads-cft.txt
Last active December 31, 2015 04:59
The AdS/CFT correspondence for political scientists
In a vastly oversimplified nutshell:
String theories are theoretical physics frameworks in which particles
have one dimension ("strings") instead of zero-dimensions ("points").
The different particles we observe arise from these strings being in
different quantum states. In order to be consistent with quantum
mechanics, string theories require the existence of higher dimensions,
beyond the classical 3 spatial and 1 temporal dimensions. (The original
bosonic string theory postulated 26 dimensions; superstring theories use
10; M-theory, the new hotness, has 11.)
@larryv
larryv / py-scipy.patch
Created February 10, 2014 01:31
Enabling a universal MacPorts build of SciPy.
Index: Portfile
===================================================================
--- Portfile (revision 116903)
+++ Portfile (working copy)
@@ -3,6 +3,7 @@
PortSystem 1.0
PortGroup python 1.0
+PortGroup muniversal 1.0
def times(chars: List[Char]): List[(Char, Int)] = {
def incr(pairs: List[(Char, Int)], C: Char): List[(Char, Int)] =
pairs match {
case Nil => List((C, 1))
case (C, n) :: ps => (C, n+1) :: ps
case p :: ps => p :: incr(ps, C)
}
(chars foldLeft List[(Char, Int)]())(incr)
}
def sortCodeTrees[T <: CodeTree](trees: List[T]): List[T] = {
val pivot = trees.length / 2
if (pivot == 0) trees
else {
def merge(xs: List[T], ys: List[T]): List[T] = (xs, ys) match {
case (Nil, ys) => ys
case (xs, Nil) => xs
case (x :: xs1, y :: ys1) =>
if (weight(x) < weight(y)) x :: merge(xs1, ys)
else y :: merge(xs, ys1)
#!/usr/bin/env zsh
emulate -R zsh # Reset (most) options to defaults.
setopt EXTENDED_GLOB
##### APPETIZERS (or: preliminary setup) #####
#
# Adapted from git's "git-sh-setup".
@larryv
larryv / gist:6ac42cb9e9599d14ac6d
Created September 8, 2014 19:45
C++ is terrible
[20:36:38] <larryv> geekosaur: oy, all this is giving me a headache
[20:38:13] <geekosaur> yes
[20:45:29] <geekosaur> hopefully my latest reply clarifies the actual issue
[20:50:03] <geekosaur> (implied but not stated, btw: C++11 broke *everyone's* existing C++ runtime API/ABI)
[20:53:41] <larryv> haha
[20:53:58] <larryv> yes, it's much clearer now, thanks
[20:54:45] <geekosaur> also it is bnoth API and ABI because they need bit level compatibility for objects compiled with one C++ compiler to work with objects compiled by a different one; API alone is insufficient
[20:58:12] <larryv> is that mitigated if both standard libraries use the same low level support?
[20:58:30] <larryv> i.e., libstdc++ on OS X using libc++abi
[20:58:35] <larryv> or libc++ on Linux using libsupc++
# Save port to hold space.
/ has the variants/ {
s/ has .*$//
h
d
}
# Remove noise.
/conflicts with/d
/^[^:]*mariadb[^:]*:/b db_variant