Skip to content

Instantly share code, notes, and snippets.

@heetbeet
heetbeet / emdw-deps
Created Jan 25, 2022
Example wrapper for g++ build tools pipeline
View emdw-deps
cur_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
cur_dir="$(dirname "${cur_script}")"
dot=$cur_dir
slash=$cur_dir/linux
libs=$dot/devel/prlite/build/src:$dot/devel/gLinear/build/Linux-Release-x86_64:$slash//usr/lib/x86_64-linux-gnu/blas:$slash/usr/lib/x86_64-linux-gnu/lapack:$slash/lib:$slash/lib/x86_64-linux-gnu:$slash/usr/lib:$slash/usr/lib/x86_64-linux-gnu:$slash/usr/local/lib
headers=$dot/devel/prlite/src:$dot/devel/gLinear:$slash/usr/include/c++/9:$slash/usr/local/include:$slash/usr/include:$slash/usr/include/x86_64-linux-gnu
bins=$dot/VSCode-linux-x64:$slash/usr/local/bin:$slash/usr/bin:$slash/bin
View Adding Fonts Without Elevation.md

Did you know you can install fonts without elevation?

The catch is that they're only available for the duration of your session. They are, however, available in all apps across the system.

Someone asked about how to do it on Facebook this week, and at first, I just pointed them at the install script for PowerLineFonts which loops through all the fonts in a folder and install them.

I've used this more than a few times to install some fonts, including the PowerLine ones, which are great:

$sa = New-Object -ComObject Shell.Application
@heetbeet
heetbeet / Compile-Julia-on-Windows.md
Last active Jan 11, 2021
Lazy guide for compiling Julia on Windows
View Compile-Julia-on-Windows.md

Setup your environment

Get cygwin portable

  • Download and place cygwin-portable-installer.cmd in the base directory.
  • Edit cygwin-portable-installer.cmd and add the following line (for additional Cygwin dependencies) after line set CYGWIN_PACKAGES=bash-completion,...:

    set CYGWIN_PACKAGES=%CYGWIN_PACKAGES%,cmake,gcc-g++,git,make,patch,curl,m4,python3,p7zip,mingw64-i686-gcc-g++,mingw64-i686-gcc-fortran,mingw64-x86_64-gcc-g++,mingw64-x86_64-gcc-fortran (The list of packages is taken from [build-windows.md](https://github.com/JuliaLang/julia/blob/master/doc/b
@heetbeet
heetbeet / unix2dos_batfiles.sh
Created Aug 26, 2020
Convert all bat files in a subdirectory to dos crlf format
View unix2dos_batfiles.sh
find . -name '*.bat' -type f -print0 | xargs -0 unix2dos --
@heetbeet
heetbeet / sync-time.bat
Created Aug 25, 2020
Manually sync microsoft time
View sync-time.bat
@echo off
if "%~1" equ "isadmin" goto :runmain
powershell "Start-Process -FilePath '%~f0' -WorkingDirectory '%~dp0' -Verb RunAs -ArgumentList isadmin"
goto :eof
:runmain
net start W32Time
w32tm /resync
@heetbeet
heetbeet / regwalk.py
Created Aug 3, 2020
Walk through windows registry
View regwalk.py
import winreg
from contextlib import suppress
import itertools
from path import Path
def subkeys(path, hkey=winreg.HKEY_CURRENT_USER):
flags=0
with suppress(WindowsError), winreg.OpenKey(hkey, path, 0, winreg.KEY_READ|flags) as k:
for i in itertools.count():
@heetbeet
heetbeet / python.py
Created May 2, 2020
Compile this file to get a mini python.exe with auto-py-to-exe
View python.py
'''
This script mimicks part of the python executable, in order for it to be
compiled and shipped using auto-py-to-exe
'''
import sys
import os
thisdir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(thisdir, 'site-packages'))
sys.path.insert(0, os.path.join(thisdir))
@heetbeet
heetbeet / multiitem_excel_formulas.py
Last active Feb 12, 2020
When does excel use a single item from a named range v.s. all the items?
View multiitem_excel_formulas.py
'''
This script serves as and answer to the stack overflow question
https://stackoverflow.com/questions/59652623/when-does-excel-use-a-single-item-from-a-named-range-v-s-all-the-items
'''
import urllib.request
from path import Path
import collections
@heetbeet
heetbeet / email-attachment-extractor.py
Created Dec 17, 2019
Extract all email attachments from eml files
View email-attachment-extractor.py
'''
The MIT License (MIT)
Copyright (c) 2014 Patrick Olsen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
View emdw-restructure.md

Emdw code restructure

Johan du Preez and I are in the process of restructuring emdw with the following aims:

  1. easier integration with external libraries and projects, less reinventing the wheel
  2. more use of Boost (less reinventing the wheel) https://github.com/boostorg https://www.boost.org/
  3. moving our tests from PatrecII to Google Test https://github.com/google/googletest
  4. moving our linear algebra and matrix libraries from gLinear and PatrecII to xtensor https://github.com/QuantStack/xtensor
  5. removing gLinear and PatrecII as external libraries
  6. easier housekeeping and modularisation
  7. separating core components from work-in-progress
  8. support for clang and cling https://github.com/QuantStack/xeus-cling