Skip to content

Instantly share code, notes, and snippets.

View ExpHP's full-sized avatar

Michael Lamparski ExpHP

View GitHub Profile
@ExpHP
ExpHP / notes.md
Last active September 14, 2017 15:52

Deploying the rust compiler to Blue Gene

Luckily for us, powerpc64-unknown-linux-gnu is a supported target triple, and we can download the toolchain through rustup.

If a firewall prevents the use of rustup on the remote machine, you can download the toolchain on your own machine

[ lampam@arch-t430s ] ~
$ rustup toolchain add 1.20.0-powerpc64-unknown-linux-gnu
$ cd ~/.rustup/toolchains/1.20.0-powerpc64-unknown-linux-gnu/
@ExpHP
ExpHP / notes.md
Last active August 15, 2018 01:27

Deploying the rust compiler to Blue Gene

Luckily for us, powerpc64-unknown-linux-gnu is a supported target triple, and we can download the toolchain through rustup.

If a firewall prevents the use of rustup on the remote machine, you can download the toolchain on your own your own machine:

$ rustup toolchain add 1.20.0-powerpc64-unknown-linux-gnu
$ cd ~/.rustup/toolchains/1.20.0-powerpc64-unknown-linux-gnu/
$ tree -d -L 2
@ExpHP
ExpHP / cargo-deps.py
Created September 14, 2017 00:16
cargo-deps.py
#!/usr/bin/env python3
import os
import sys
# Prints cargo deps (each name-version pair), gathered recursively.
# I couldn't find anything that does this in cargo.
def main():
import argparse
@ExpHP
ExpHP / Main.hs
Created September 2, 2017 19:12
sieveSmallestFactor benchmark
module Main where
import Math.NumberTheory.Primes.Factorisation
import Data.Word
import Text.Printf
import System.CPUTime
data P = P { unP :: !Word64 }
oldWay :: FactorSieve -> Integer -> Integer
$ cabal test
Preprocessing library arithmoi-0.5.0.1...
Preprocessing test suite 'spec' for arithmoi-0.5.0.1...
Linking dist/build/spec/spec ...
/usr/bin/ld: cannot find -lHStagged-0.8.5-DG0qxw3gXxx4NfDcDx4Iai
/usr/bin/ld: cannot find -lHSregex-tdfa-1.2.2-JFeutuWiS2vGBM4qXQlqio
/usr/bin/ld: cannot find -lHSregex-base-0.93.2-AYjYAsBidAc8f5XNm9b2Aa
/usr/bin/ld: cannot find -lHSparsec-3.1.11-1CA7c0vSU7tJHGhveOjoXR
/usr/bin/ld: cannot find -lHStext-1.2.2.2-3ENqlljngKa6xj1Go2fVWq
/usr/bin/ld: cannot find -lHSbinary-0.8.3.0
@ExpHP
ExpHP / a.py
Created August 29, 2017 19:08
numpy memory leak
from __future__ import print_function
import objgraph
import numpy as np
print('--------------------------------------------------')
print('Numpy info:')
print()
print(np.__version__)
print()
np.show_config()
@ExpHP
ExpHP / module-proposals-birds-eye.md
Last active August 24, 2017 18:36
module proposals from a birds-eye view

Proposals

  • TODO: internals threads
  • [Automatically Usable External Crates – cramertj]
    • TODO
  • TODO: more internals threads
  • TODO: where was that initial proposal for automodules?
    • (IIRC it defaulted to pub for directories?)
    • (wasn't this niko?)
  • TODO: more internals threads
import numpy as np
import timeit

def measure(s):
	ts = timeit.repeat(s, globals=globals())
	print(f'{s:>20}: {min(ts):>6.3f}s ({ts})')


x = 2
@ExpHP
ExpHP / xdg-generic-test.md
Last active March 15, 2026 04:09
xdg open_generic test

Testing setup

I improved my testing setup a bit from what I used in this comment. Now you can see when argdebug gets called multiple times.

$HOME/bin/argdebug

#!/bin/sh
echo >&2 'argdebug'
for x in "$@"; do
@ExpHP
ExpHP / open-xdg-always-generic.patch
Created August 20, 2017 15:16
open-xdg always generic patch
--- /usr/bin/xdg-open 2017-05-30 17:23:44.243430717 -0400
+++ /home/lampam/bin/xdg-open 2017-08-20 11:09:15.153327227 -0400
@@ -974,52 +974,4 @@
;;
esac
-case "$DE" in
- kde)
- open_kde "$url"
- ;;