Skip to content

Instantly share code, notes, and snippets.

View cosmicexplorer's full-sized avatar
🎨
building some software right now you will probably end up using at some point

Danny McClanahan cosmicexplorer

🎨
building some software right now you will probably end up using at some point
View GitHub Profile
@cosmicexplorer
cosmicexplorer / wrapExceptions.coffee
Last active February 2, 2016 07:13
catch asynchronous exceptions in node without losing the stack history
getCalledStack = (fun) ->
prevErr = new Error "memoized stack frame"
(args...) -> try fun args... catch err then throw [prevErr].concat err
memoizedFn = -> throw new Error "i'm an exception!"
beginStack = ->
memo = getCalledStack memoizedFn
# creating new stack frame
process.nextTick ->
@cosmicexplorer
cosmicexplorer / Makefile
Last active February 2, 2016 06:39
makefile with lots of fun magic and dollar signs
.PHONY: all train test clean
SRC_DIR := cs362
IN_JAVA := $(wildcard $(SRC_DIR)/*.java)
OUT_JAVA := $(IN_JAVA:.java=.class)
all_past_n = $(wordlist $(1),$(words $(2)),$(2))
JAVAC_OPTS := -Xdiags:verbose
JAVA_CP := "commons-cli-1.2.jar:commons-math3-3.2.jar:."
@cosmicexplorer
cosmicexplorer / async-fetch.py
Created September 25, 2016 22:39
example of fetching multiple webpages at once using asynchrony with grequests
# need to 'pip install grequests'
import grequests
from html.parser import HTMLParser
class FetchTitleTag(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.inTitle = False
def handle_starttag(self, tag, attrs):
if tag == 'title':
@cosmicexplorer
cosmicexplorer / make-pants-zinc-native-image.bash
Created March 16, 2019 03:01
make a native image of the pants zinc wrapper
#!/usr/bin/env bash
set -euxo pipefail
# NB: `mx` needs to be on $PATH!
if [[ ! -d 'openjdk1.8.0_202-jvmci-0.56' ]]; then
if [[ "$(uname)" == 'Linux' ]]; then
_jvmci_url_component='linux'
else
@cosmicexplorer
cosmicexplorer / gist:18628b9e58d7c7ab02ccab3cba570675
Created May 10, 2019 03:49
example failing ouput fixed by https://github.com/pantsbuild/pants/pull/7695 (reproducible if 3rdparty/python/BUILD is edited to have prepend_to_pythonpath=False).
> ./pants test examples/tests/python/example_test/pkg_resources_access -- -vs
20:45:00 00:00 [main]
(To run a reporting server: ./pants server)
20:45:02 00:02 [setup]
20:45:22 00:22 [parse]
Executing tasks in goals: bootstrap -> imports -> unpack-wheels -> unpack-jars -> deferred-sources -> native-compile -> link -> jvm-platform-validate -> gen -> resolve -> resources -> compile -> pyprep -> test
20:45:23 00:23 [bootstrap]
20:45:23 00:23 [substitute-aliased-targets]
20:45:23 00:23 [jar-dependency-management]
20:45:23 00:23 [bootstrap-jvm-tools]
@cosmicexplorer
cosmicexplorer / repro-bigquery.diff
Last active May 11, 2019 01:48
checking out https://github.com/pantsbuild/pants at 4dafc870ece338be7bbba4e44ee1e416e27e9afb, then running test-bisect.zsh, should show that pex==1.5.3 suceeds, and pex==1.6.0 errors out at import time for the google-cloud-bigquery package.
diff --git a/3rdparty/python/requirements.txt b/3rdparty/python/requirements.txt
index 9c0e693..0b93f20 100644
--- a/3rdparty/python/requirements.txt
+++ b/3rdparty/python/requirements.txt
@@ -17,7 +17,7 @@ more-itertools<6.0.0 ; python_version<'3'
packaging==16.8
parameterized==0.6.1
pathspec==0.5.9
-pex==1.6.6
+pex==1.5.3
@cosmicexplorer
cosmicexplorer / bsp-interaction-debug-log.txt
Last active June 22, 2019 21:52
pants bsp interaction hanging on compile
[bloop-compile]
21:35:30 [DEBUG] pants.java.executor:pid=26932: Executing: /Users/dmcclanahan/Downloads/openjdk1.8.0_202-jvmci-0.59/Contents/Home/bin/java -cp /Users/dmcclanahan/workspace/s3/.pants.d/ng/BloopCompile_bloop_bloop_compile/tmpkGwduV.jar pants.contrib.bloop.compile.PantsCompileMain debug -- macaw.macaw-test.macaw-test macaw.macaw-test.tests macaw.macaw-test.src.test.scala.scala macaw.macaw-test.src.test.thrift.thrift-scala macaw.macaw-test.src.main.scala.scala .pants.d.gen.scrooge.55f6998c5e42.macaw.m.837d4a355d20a4bb.w.macaw-test.src.test.thrift.thrift-scala args={} at cwd=/Users/dmcclanahan/workspace/s3
Starting the bsp launcher for bloop...
A bloop installation has been detected either in the PATH or $HOME/.bloop
Opening a bsp server connection with 'bloop bsp --protocol local --socket /var/folders/_r/gknsp2dd6bs3k1y9s6btxbyc0000gn/T/bsp-launcher8059555547206668069/bsp.socket'...
Waiting 200ms until the bsp conn
@cosmicexplorer
cosmicexplorer / posix-memalign-removal.diff
Created December 22, 2019 01:05
applying this patch should unbreak emacs master on osx!
diff --git a/configure.ac b/configure.ac
index 3b6a2a6d16..90060e4f48 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4184,7 +4184,7 @@ AC_DEFUN
LIBS=$OLD_LIBS
dnl No need to check for posix_memalign if aligned_alloc works.
-AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
+AC_CHECK_FUNCS([aligned_alloc], [break])

Keybase proof

I hereby claim:

  • I am cosmicexplorer on github.
  • I am turingtarpit (https://keybase.io/turingtarpit) on keybase.
  • I have a public key ASAtpc3YkMi3LvmdB8c7__vT5ehF_fLiyjrwp_utOczB8go

To claim this, I am signing this object: